Nice. Went through a wiki article on Command Pattern. Very much the design i need. Will try to do that when I get back to the activity log :). Thanks.
On Aug 13, 10:49 am, Robb <robb.shec...@gmail.com> wrote: > Thanks, Ram. Yep, I realized that polymorphic associations is exactly > what I was talking about. In my case, all the log info is private and > per-user. Also, the only action is "view", so I have a simpler case > than you. I just need to generate a list like, > > Today > Document 452.242 > Document 551.432 > > Yesterday > Document 43.234 > Chapter 452 > > Now, in your case, I wouldn't worry at *all* about how to generate the > text. This is an issue for the presentation layer. I'd just be > concerned with making sure I have all the relevant objects so that the > various templates can render the output appropriately: the currently > logged in user, a list of log entries, each of which has a reference > to the relevant object, the method invoked, and the user who did it. > > I suggest checking out the "Command" design pattern. It kind of > sounds like what you're doing. > > - Robb > > On Aug 12, 9:29 pm, Ram <yourstruly.vi...@gmail.com> wrote: > > >... The only > > part that I havent figured out though is writing neat code for the > > actual message or sentence the user will read. Like, > > > You edited the task - Change tyres on car > > Robb completed the task - Change tyres on car --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---