Hello peeps, I currently have the following models: Users, which can have multiple blog posts, and a Forum with topics and posts. So a user can post a blog item, but also a topic/post on the forum I want to give my users the ability to "watch" a blog post, or a forum topic, so a little email will be sent when something happens on whatever they''re watching. I can''t get my head around a good solution to tackle this problem. I want to have the possibily to extend my ''watching'', because in the future my users want to watch something else, so I was thinking along the line of :polymorphic, but I can''t get it to work. Any ideas?... -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/29/06, Bart Zonneveld <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hello peeps, > > I currently have the following models: > Users, which can have multiple blog posts, and a Forum with topics and > posts. > So a user can post a blog item, but also a topic/post on the forum > > I want to give my users the ability to "watch" a blog post, or a forum > topic, so a little email will be sent when something happens on whatever > they''re watching. > > I can''t get my head around a good solution to tackle this problem. I > want to have the possibily to extend my ''watching'', because in the > future my users want to watch something else, so I was thinking along > the line of :polymorphic, but I can''t get it to work. Any ideas?...I think you''re on the right track with :polymorphic. However, some sample code would help in diagnosing your problem. --> Posted via http://www.ruby-forum.com/. > > > >Michael Guterl --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Michael Guterl wrote:> On 9/29/06, Bart Zonneveld <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> topic, so a little email will be sent when something happens on whatever >> they''re watching. >> >> I can''t get my head around a good solution to tackle this problem. I >> want to have the possibily to extend my ''watching'', because in the >> future my users want to watch something else, so I was thinking along >> the line of :polymorphic, but I can''t get it to work. Any ideas?... > > > I think you''re on the right track with :polymorphic. However, some > sample > code would help in diagnosing your problem.Well, I don''t really have any sample code to share, since I am in the process of trying to set it up. Except for maybe: class User has_many :blogposts has_many :topics has_many :forumposts end class Post belongs_to :user end class Blogpost < Post end class ForumPost < Post end -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/29/06, Bart Zonneveld <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Michael Guterl wrote: > > On 9/29/06, Bart Zonneveld <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> topic, so a little email will be sent when something happens on > whatever > >> they''re watching. > >> > >> I can''t get my head around a good solution to tackle this problem. I > >> want to have the possibily to extend my ''watching'', because in the > >> future my users want to watch something else, so I was thinking along > >> the line of :polymorphic, but I can''t get it to work. Any ideas?... > > > > > > I think you''re on the right track with :polymorphic. However, some > > sample > > code would help in diagnosing your problem. > > Well, I don''t really have any sample code to share, since I am in the > process of trying to set it up. Except for maybe:Well you mentioned in your earlier post that you tried :polymorphic and it did not work. I was trying to determine "what did not work" with :polymorphic. class User> has_many :blogposts > has_many :topics > has_many :forumposts > end > > class Post > belongs_to :user > end > > class Blogpost < Post > end > > class ForumPost < Post > endCheck out: http://blog.hasmanythrough.com/articles/2006/04/03/polymorphic-through This is the most comprehensive tutorial I have seen or used for polymorphic associations. --> Posted via http://www.ruby-forum.com/. > > > > Michael Guterl--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---