Revision 1b7ff312
Added by Stephen Benjamin over 9 years ago
app/models/concerns/has_many_common.rb | ||
---|---|---|
extend ActiveSupport::Concern
|
||
|
||
def assoc_klass(association)
|
||
association.to_s.classify.constantize
|
||
self.class.reflect_on_association(association).klass
|
||
end
|
||
|
||
# calls method :name or whatever is defined in attr_name :title
|
Also available in: Unified diff
fixes #9025 - reflect on association for _name(s) methods
(cherry picked from commit 1cf860b74143da2e0f85b89913cac4cb84e20d4e)
Conflicts:
test/lib/has_many_common_test.rb