By default, an activerecord model has attr_accessor for all the 开发者_JAVA百科table columns correct?
No, this is not correct. An active record object will have getter and setter methods for all columns, but these are not defined using attr_accessor nor do they act like ones that are defined using attr_accessor:
While the getters and setters defined by attr_accessor get and set instance variables, the getters and setters on an active record objects get and set values in the @attributes hash, which every active record object has.
加载中,请稍侯......
精彩评论