[Rails] polymorphic associations and STI
If a Problem with a polymorphic association and STI.
class Message < ActiveRecord::Base
belongs_to :source, :polymorphic => true
end
class Letter < Message
end
class Post < ActiveRecord::Base
has_many :messages, :as => :source
end
Post.first.messages works fine
Post.first.letters
Throws "NoMethodError: undefined method `letters' for
#<Post:0xb6671ef0>"
Thanks for your help.
lg
xinu
--
Posted via http://www.ruby-forum.com/.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home