On 14 February 2012 09:54, Marcos Korody <[email protected]> wrote:
> I have two different models. USERS and POSTS. Untill the present moment I
> have a pretty straight forward relationship between them.
>
> I want a USER to also have the ability to set an original AUTHOR to the
> content of his POST.
> In other words, a POST belongs to a USER (submitter who's posting some
> content) and also belongs to an original AUTHOR(a person who's post content
> is originaly from).

Not an odd request at all :-)

You want to look online for "rails self referential associations"

But essentially, in your User model add:
  belongs_to :author, :class_name => "User"

and add a migration for the author_id field to be added to the users table.

-- 
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