Nice.. that seems like a good option. So assuming that im gonna use link_to to generate the HTML, I will have to generate the message in either the controller or view right? was hoping i could generate the message in the model keeping the controller clean.
anyway, ill get on that. anymore ideas or suggestions? On Aug 3, 9:06 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas- s.net> wrote: > Ram wrote: > > Hi all, > > > Im looking to write an activity log as part of the dashboard for one > > of my apps. The log should show messages like > > > "Vinay created the project Acme Inc Website", "You completed 2 tasks > > in the project Acme Inc website" > > > and so on. > > > So i went about creating an activities table with controller, action, > > user, message and timestamps. Now the messages the user sees in his > > dashboard should have links on words like "You", "Vinay", "Acme Inc > > Website" and so on such that they link to those respective resources. > > I created the "message" column in the Activities table thinking i can > > dynamically create the message and store it in DB and extract it for > > the dashboard. All that works fine but now how do I insert the links? > > Well, you could just generate the whole HTML string and store it, but I > assume that you want me to see "Vinay" and Vinay to see "you" for the > same message, so that won't quite work. > > > > > whats the best strategy for this? scrap what I have done and please > > suggest ideas on how you might approach this problem. one thing I DO > > NOT want to do is dynamically generate those messages in the view. I > > just think it will be too much load on the db AND rendering action > > itself as compared to storing the message and applying the links > > dynamically on retrieval somehow. > > This may well be premature optimization. > > > > > thoughts? ideas? suggestions? > > > thanks.. > > Take a leaf out of Facebook's book. Use an intermediate representation > in the DB: something like "[user 110] created project Acme". Then parse > that when the view is created, so that user 110 sees "you" and everyone > else sees user 110's name. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...@marnen.org > -- > Posted viahttp://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@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 -~----------~----~----~----~------~----~------~--~---