Есть ли в ActiveModel модуль, включающий метод «update_attributes»?

Я настроил класс ActiveModel в моем приложении Rails, например:

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 самостоятельно, но мне кажется, что он где-то существует. Так ли это?

7
задан Brandon Yarbrough 11 June 2012 в 06:32
поделиться