Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

define_attribute_methods interface differs between ActiveModel and ActiveRecord

#6138

ActiveModel allows passing an array of methods on which attribute_method_suffix,prefix,affix etc methods will be defined.
ActiveRecord however overrides the define_attribute_methods but without parameters, so the methods provided to attribute_method_suffix, prefix, affix get defined for ALL columns of the model. You may want to define the prefix/suffix/affix methods for only a subset of columns however.

Will update with more information, tests, patch, shortly.

Reported by Aditya Sanghi · December 9th, 2010 @ 12:37 PM

State: wontfix
Milestone: 3.x
Assigned to: Aditya Sanghi Aditya Sanghi
Importance: Low

Activity

  1. Aditya Sanghi
    Aditya Sanghi
    • State changed from needs-more-info to wontfix

    Closing ticket. I think the way the method_missing/respond_to is implemented in ActiveRecord, it would be way too tricky to do this selectively define methods for only a subset of columns in ActiveRecord.

    December 9th, 2010 @ 12:59 PM