What would be the best way to implement Message console in RoR? What I am trying to accomplish is to broadcast all the events for user activity for a session in a comsole DIV. e.g. If usr deleted something, it would show up ''You deleted this'' , if they added something, it will show up as ''You added this'' . This don''t need to persist after user logs off but i do want to persisit it for admin Because I would want admin to monitor those messages and keep an eye on what''s going into the system. for admin , mesasge would show up as ''User A deleted this , ''User A added that'' Also i want to use the same message console window to capture admin notifications/announcements. e.g. If admin want to announce a meeting, it should show up in mesage console of the user. Now If the user wasnt logged on when it was announced, user show see the mesasage when they log in. Any suggestios? --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Rails junkie wrote:> What would be the best way to implement Message console in RoR? > What I am trying to accomplish is to broadcast all the events for user > activity for a session in a comsole DIV. > e.g. If usr deleted something, it would show up ''You deleted this'' , > if they added something, it will show up as ''You added this'' . This > don''t need to persist after user logs off but i do want to persisit > it for admin > Because I would want admin to monitor those messages and keep an eye > on what''s going into the system. > for admin , mesasge would show up as ''User A deleted this , ''User A > added that'' > > Also i want to use the same message console window to capture admin > notifications/announcements. e.g. If admin want to announce a meeting, > it should show up in mesage console of the user. > > Now If the user wasnt logged on when it was announced, user show see > the mesasage when they log in. > > Any suggestios?I would create a Log model. Then use callbacks in the models, like after_create, after_update and after_destroy to create records. class Foo < ActiveRecord::Base after_create :log_creation def log_creation Log.create( :message => "a new #{self.class} with id of #{id} was created", :other_attr => ''...'' ) end 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?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for taking time to reply. I think i took the right direction. On Feb 25, 6:32 pm, Alex Wayne <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Rails junkie wrote: > > What would be the best way to implement Messageconsolein RoR? > > What I am trying to accomplish is tobroadcastall the events for user > > activity for a session in a comsole DIV. > > e.g. If usr deleted something, it would show up ''You deleted this'' , > > if they added something, it will show up as ''You added this'' . This > > don''t need to persist after user logs off but i do want to persisit > > it for admin > > Because I would want admin to monitor those messages and keep an eye > > on what''s going into the system. > > for admin , mesasge would show up as ''User A deleted this , ''User A > > added that'' > > > Also i want to use the same messageconsolewindow to capture admin > > notifications/announcements. e.g. If admin want to announce a meeting, > > it should show up in mesageconsoleof the user. > > > Now If the user wasnt logged on when it was announced, user show see > > the mesasage when they log in. > > > Any suggestios? > > I would create a Log model. Then use callbacks in the models, like > after_create, after_update and after_destroy to create records. > > class Foo < ActiveRecord::Base > after_create :log_creation > > def log_creation > Log.create( > :message => "a new #{self.class} with id of #{id} was created", > :other_attr => ''...'' > ) > end > end > > -- > Posted viahttp://www.ruby-forum.com/.- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---