This project is archived and is in readonly mode.

#6138 ✓wontfix
Aditya Sanghi

define_attribute_methods interface differs between ActiveModel and ActiveRecord

Reported by Aditya Sanghi | December 9th, 2010 @ 12:37 PM | in 3.x

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.

Comments and changes to this ticket

  • Aditya Sanghi

    Aditya Sanghi December 9th, 2010 @ 12:59 PM

    • 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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages