Ruby on rails ActiveRecord/Ruby on Rails中update_all()的返回值是多少?

Ruby on rails ActiveRecord/Ruby on Rails中update_all()的返回值是多少?,ruby-on-rails,activerecord,rails-activerecord,Ruby On Rails,Activerecord,Rails Activerecord,RubyonRails和ActiveRecord文档、Google和StackOverflow都对update_all()的返回值保持沉默 update_all()返回什么 记录的数量 成功状态 更新记录的ID ActiveRecord的update\u all()返回更新的记录数 describe '.update_all' do let!(:user1) { create :user } let!(:user2) { create :user } let!(:user3) {

RubyonRails和ActiveRecord文档、Google和StackOverflow都对update_all()的返回值保持沉默

update_all()返回什么

  • 记录的数量
  • 成功状态
  • 更新记录的ID
ActiveRecord的update\u all()返回更新的记录数

describe '.update_all' do
  let!(:user1) { create :user }
  let!(:user2) { create :user }
  let!(:user3) { create :user }

  it 'returns number of records updated' do
    expect(User.update_all(last_name: 'Smith')).to eq 3
  end
end
收益率:

User
  .update_all
    returns number of records updated

Finished in 0.1245 seconds (files took 13.17 seconds to load)
1 example, 0 failures

可能还会发布一个带有文档修复的PR?事实上,这个信息看起来应该存在。我站起来迎接这个时刻,@SergioTulentsev!我原以为这将是一个快速的克隆/编辑/推送/公关…但我以前从未对rails做出过贡献。正在完成rails开发框的设置…选中了吗?