I'm building a blog application that allows users to create and edit blog posts. I want to add the ability for a user to check a box on the post page that enables an alert on the post that sends an email to the user when the post is updated.
I would think my alerts table would simply consist of a user_id, a post_id and a created_at timestamp. So in modeling the associations for this, my first thought was that this would be a has_many :through association but I'm not sure how or where I would make that association. Is this thought process on the right path? Thanks for any help. class Post < ActiveRecord::Base belongs_to :creator, :class_name => "User", :foreign_key => "created_by" has_many :alerts, :dependent => :destroy end class User < ActiveRecord::Base has_many :created_posts, :class_name => "Post", :foreign_key => "created_by" has_many :alerts, :dependent => :destroy end class Alert < ActiveRecord::Base belongs_to :post belongs_to :user end --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---