BTW, your table should have an "author_id" column (usually an integer)
and an "author_type" column (usually a varchar).

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Sun, Feb 8, 2009 at 4:09 PM, Maurício Linhares
<[email protected]> wrote:
> class Article < ActiveRecord::Base
>  belongs_to :author, :polymorphic => true
> end
>
> And then to assign an author:
>
> article = Article.new
> article.author = some_author
> article.save
>
> -
> Maurício Linhares
> http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
>
>
>
> On Sun, Feb 8, 2009 at 4:06 PM, ms <[email protected]> wrote:
>>
>> Thank you for your answer. I read this article before, but I can't map
>> this technique to my problem. Maybe you can help me with this?
>>
>> Thank you!
>> >>
>>
>

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