Topic: class constant from polymorphic relation
Let's say I have a class constant in each model that my polymorphic model can connect to, e.g.
class Cat < ActiveRecord::Base NOISE = %w(meow growl) end class Dog < ActiveRecord::Base NOISE = %w(bark sniff) end
Now, from the polymorphic model I want to show a select list with the noises from the connected model.
:collection => mypet.pet_type.class.constants.index('NOISE')
is not the answer... Googling 'introspection' isn't helping.
I'm lost. Any ideas?