You're on the right track - the :through part comes in when you want
to go directly from Post to User. The following associations will do
what you're looking for:
- on Post
has_many :alert_users, :through => :alerts, :source => :user
- on User
has_many :alert_posts, :through => :alerts, :source
go ahead with your original design.
On Fri, Jun 5, 2009 at 8:54 PM, JL Smith wrote:
>
> Yeah, another user can update somebody's post but I don't think that
> even matters in this case (think of this as having multiple admins
> editing posts). The alerts table still needs to connect both the us
Yeah, another user can update somebody's post but I don't think that
even matters in this case (think of this as having multiple admins
editing posts). The alerts table still needs to connect both the user
and the post so that a user other than the user that created the post
can enable an alert o
basic question, Can a user update post of another user ?
If yes
then your approach is correct.
If no,
then you need not have user_id in alerts table
in this case relationships will be
class Post < ActiveRecord::Base
belongs_to :creator, :class_name => "User", :foreign_key =>
"created_by"
has_ma
4 matches
Mail list logo