approved
.
Edit Multiple Individually Railscast
我觉得很合适。然而,我遇到的问题,我追溯到
ActiveRecord::Base#update
.
update
>> User.all.map(&:username)
=> ["ben", "fred"]
>> h = {"1"=>{'username'=>'benjamin'}, "2"=>{"username"=>'frederick'}}
=> {"1"=>{"username"=>"benjamin"}, "2"=>{"username"=>"frederick"}}
>> User.update(h.keys, h.values)
=> ...
>> User.all.map(&:username)
=> ["benjamin", "frederick"]
>> User.all.map(&:approved)
=> [true, nil]
>> h = {"1"=>{'approved'=>'1'}, "2"=>{'approved'=>'1'}}
>> User.update(h.keys, h.values)
=> ...
>> User.all.map(&:approved)
=> [true, nil]
'1'
到
true
我做错什么了?