You are finding it difficult because it is not a recommended practice
for the model to know anything about the session. The controller that
invokes your model method to track payments should set the
authentication to the user that is involved in the payment if that is
what you want done. Separating these issues of data management and
session management is a key aspect of Rails.
Michael
On Jun 14, 1:22 pm, Emanuele Mek Tozzato
<etozz...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Ciao PPL!
>
> in our project we use this global method:
>
> # application.rb
> def set_user_authenticated(user)
> self.app_user = user
> end
>
> I need to call it from inside a method that belongs to User model..
>
> # user.rb
> def track_successful_payment(promo, transaction_id)
> ....
> set_user_authenticated(self)
> ....
> end
>
> I''ve tried to create a new method:
>
> def track_successful_payment(promo, transaction_id)
> ....
> self.set_authenticated
> ....
> end
>
> # in user.rb
> def set_authenticated
> super.set_user_authenticated(self)
> end
>
> but I''m not on the right way...
>
> please help this is more than critical right now! :D
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---