On Feb 28, 2:44 pm, Joe Canares <[email protected]>
wrote:
>
> I'm trying to append files to either a "post" or a "message". Files
> belong to either a post or a message.
>
> So post-model:
>
> has_many :files
>
> message-model:
>
> has_many :files
>
> file-model:
>
> belongs_to :post
> belongs_to :message
>
> I'm trying to add the file-functionality to the existing
> post/message-structure.

You might want to have a look at polymorphic associations, or you
could just have two separate belongs_to, one of which will be null for
any given file.

Fred
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to