> You need to let ActiveRecord know about the association:
> (You don't specify the Rails version you're using, but I'm guessing 2.x)


Yes, using Rails 2.1




> class User < ActiveRecord::Base
>   has_many :reviews, :as => :reviewable  # can users be reviewed like
> Books, etc.?
> 
>   # if you mean for user.reviews to be the set of reviews
>   # that this user wrote, then you want:
>   has_many :reviews, :foreign_key => 'review_user_id'
> end
> 


In my reviews table I have 2 user values, created_by and modifed_by. 
Users can not be reviewed, but you can view all of the reviews per user. 
Can I do the foreign key like you have in your second example if my 
review table has 2 fields that link back to the user.id field?


-- 
Posted via http://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