私はこのように私のRailsアプリでActiveModelクラスを設定している:私は本当にこれを行うことができるようにしたいActiveModelには「update_attributes」メソッドを含むモジュールがありますか?
class MyThingy
extend ActiveModel::Naming
extend ActiveModel::Translation
include ActiveModel::Validations
include ActiveModel::Conversion
attr_accessor :username, :favorite_color, :stuff
def initialize(params)
#Set up stuff
end
end
:
thingy = MyThingy.new(params)
thingy.update_attributes(:favorite_color => :red, :stuff => 'other stuff')
私はちょうど自分でupdate_attributesを書くことができ、私はそれがどこかに存在すると感じています。それは?
がありますより新しいレールバージョンの啓示はまだありますか? – schmijos