Maybe one of you guys can figure this out:
User
- has_many :comments
Comment
- belongs_to :user
- belongs_to :commentable, :polymorphic => true
Story
- has_many :comments, :as => commentable
I have a story (variable called story) and I say:
story.comments.create :user_id => current_user.id
and now story.comments contains this comment but not user.comments.
The comment that was created has a commentable_id, a commentable_type,
but not a user_id, even if I specify it explicitly like above.
Am I going about creating the comment wrong or did I setup the
association wrong?
Thanks,
JB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---