mam założyć klasę ActiveModel w moim app Rails tak:Czy ActiveModel ma moduł zawierający metodę "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
naprawdę chcę być w stanie to zrobić:
thingy = MyThingy.new(params)
thingy.update_attributes(:favorite_color => :red, :stuff => 'other stuff')
mogę tylko napisać update_attributes na własną rękę, ale mam wrażenie, że gdzieś istnieje. Czy to?
Are jakiekolwiek oświecenia dla nowszych wersji szyn? – schmijos