# Please Help!

**URL:** <https://www.ruby-forum.com/t/please-help/106875>\
**Category:** Rails\
**Created:** [June 14, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/please-help/106875 "2007-06-14T22:22:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 14, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/please-help/106875/1 "2007-06-14T22:22:53Z")

</div>

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! 😃

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 14, 2007, 10:58pm UTC](https://www.ruby-forum.com/t/please-help/106875/2 "2007-06-14T22:58:06Z")

</div>

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
