Hello, In my app, there is an observer that gets fired when an change is done on one table. what i want it to do is to write into an other table the action done and the user which made the action. But until now i didn''t manage to get the session data into the observer. I always get "session, undefined methode for observer" Any ideas how i can handle this? thank you --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Observers, like models, are not meant to have access to the session. It''s a violation of the MVC pattern. You''re not really supposed to be doing what you''re doing. It does make doing auditing a bit harder. However, the Rails Recipes book shows how you can hack cache_sweepers to do what you''re trying to do. On 10/31/07, da991319 <castaingregis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hello, > > In my app, there is an observer that gets fired when an change is done > on one table. what i want it to do is to write into an other table the > action done and the user which made the action. > > But until now i didn''t manage to get the session data into the > observer. I always get "session, undefined methode for observer" > > Any ideas how i can handle this? > > thank you > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hello thank you i will try to have a look to the receipe book. but i also think about using a filter before just to respect the MVC pattern. Thank you On Oct 31, 9:38 pm, "Brian Hogan" <bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Observers, like models, are not meant to have access to the session. It''s a > violation of the MVC pattern. > > You''re not really supposed to be doing what you''re doing. It does make doing > auditing a bit harder. However, the Rails Recipes book shows how you can > hack cache_sweepers to do what you''re trying to do. > > On 10/31/07, da991319 <castaingre...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello, > > > In my app, there is an observer that gets fired when an change is done > > on one table. what i want it to do is to write into an other table the > > action done and the user which made the action. > > > But until now i didn''t manage to get the session data into the > > observer. I always get "session, undefined methode for observer" > > > Any ideas how i can handle this? > > > thank you--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---