search for: attributemethods

Displaying 3 results from an estimated 3 matches for "attributemethods".

Did you mean: attribute_methods
2011 Feb 05
3
ActiveModel::AttributeMethods limiting
In my attempt to add AM:Dirty to my model I realized that AM#AttributeMethods is a bit imperfect. It''s impossible to generate attribute methods step-by-step in DataMapper-like manner. class Model include ActiveModel::Dirty def self.property(name, klass = String) define_property_accessors(name, klass) # This method will be called once, beca...
2009 Sep 23
5
Overriding AR read/write_attribute - Overridden write_attribute Is Never Called
Could someone explain this? #config/initializers/ar_attributes.rb module ActiveRecord module AttributeMethods alias_method :ar_read_attribute, :read_attribute def read_attribute(attr_name) p "read_override" ar_read_attribute(attr_name) end alias_method :ar_write_attribute, :write_attribute def write_attribute(attr_name, value) raise '...
2010 Aug 13
2
Rails 3 / ActiveModel for Credit Card information?
...ord I would simply put has_one :credit_card accepts_nested_attributes_for :credit_card instead I added a attr_accessor :credit_card to the Order ActiveRecord class and my credit_card class looks like this.... class CreditCard include ActiveModel::Validations include ActiveModel::AttributeMethods include ActiveModel::Callbacks include ActiveModel::Conversion extend ActiveModel::Naming # belongs_to :user attr_accessor :card_type, :card_number, :card_verification, :card_expires_on, :agree validates :card_type, :card_number, :card_verification, :card_expires_on, :...