> self.sd_ticket.update_attribute("modified_by_id",#here I need value I get the feeling from this line that you are confusing the responsibilities of the Model-View-Controller. Yes, there has been much blogged about skinny controllers and fat models. However, this does not mean you should yank all of the controller's responsibilities away from it.
In my understanding, the calling of "update_attributes" method is a controller responsibility. Yes, it is the model that actually does the updating of the data but the "message' to provide the values to be updated should be sent by a controller. It's also the controller's responsibility to maintain a user's session, so it also has access to the session object. This is how people get backed into the corner (or fall into the trap) where they begin asking how to access session data in a model. It's the controller's responsibility to decouple the model from the view and controller. When you start mixing these responsibilities is when you get yourself inot trouble. Sijo Kg wrote: > Hi > I have the model SDTicket and SDCi > SDTicket > has_many :service_desk_cis > > SDCi > after_save :update_sd_ticket > belongs_to :sd_ticket > def update_sd_ticket > self.sd_ticket.update_attribute("modified_by_id",#here I need value > from session) > end > > I have a user controller in that session[:id] = current_user_id #here I > am setting current user id to session[:id] > > Could you please tell me how I can access this value from SDCi > class above in the call back after_save > > Thanks in advance > Sijo -- 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---