मैं इस तरह मेरे रेल एप्लिकेशन में किसी 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