Rails association in concerns

34 views
Skip to first unread message

Nicolò Benigni

unread,
Jun 8, 2015, 12:52:30 PM6/8/15
to rubyonra...@googlegroups.com
0
down vote
favorite
I am using concerns for my rails application. I've different kind of
users so I have made a "loggable.rb" concern.

In my concern I have
´´´
included do
has_one :auth_info
end
´´´

because every of my user that will include the concern will have an
association with auth_info table.

The problem is, what foreign keys I need to put in my auth_info table?

E.G

I've 3 kind of users:

customer
seller
visitor
If I had only customer, in my table scheme I would have put the field

"id_customer"
but in my case?

--
Posted via http://www.ruby-forum.com/.

André Orvalho

unread,
Jun 23, 2015, 5:40:02 AM6/23/15
to rubyonra...@googlegroups.com
Maybe  this can help you https://robots.thoughtbot.com/whats-the-deal-with-rails-polymorphic-associations

search google about polymorphic associations
Reply all
Reply to author
Forward
0 new messages