# Current\_user Authlogic & Service.rb

**URL:** <https://www.ruby-forum.com/t/current-user-authlogic-service-rb/185441>\
**Category:** Rails\
**Created:** [March 20, 2010, 1:49am UTC](https://www.ruby-forum.com/t/current-user-authlogic-service-rb/185441 "2010-03-20T01:49:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3bc359/32.png) [@fury](https://www.ruby-forum.com/u/fury)\
**Post date:** [March 20, 2010, 1:49am UTC](https://www.ruby-forum.com/t/current-user-authlogic-service-rb/185441/1 "2010-03-20T01:49:54Z")

</div>

Hi,

I am using Authlogic & Weborb to remote from as3.

Is it possible to access current\_user, which is defined in a helper  
method in the application controller, in a Service class.

Thank you in advance,

John.

---

<div class="post-metadata">

**Author:** ![fury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3bc359/32.png) [@fury](https://www.ruby-forum.com/u/fury)\
**Post date:** [April 3, 2010, 10:19pm UTC](https://www.ruby-forum.com/t/current-user-authlogic-service-rb/185441/2 "2010-04-03T22:19:21Z")

</div>

I have the same question, did you ever find a solution?

---

<div class="post-metadata">

**Author:** ![fury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3bc359/32.png) [@fury](https://www.ruby-forum.com/u/fury)\
**Post date:** [April 4, 2010, 8:03am UTC](https://www.ruby-forum.com/t/current-user-authlogic-service-rb/185441/3 "2010-04-04T08:03:22Z")

</div>

Unfortunately not. There are many posts regarding the wrongness of  
passing a variable to a model for example (which makes sense) and I just  
assume the same wrongness in our case - however no suggested solution.  
Just for fun I stuffed some of the user info into a global in the user  
sessions controller and it failed (as expected) in production. I tried  
also to stick it into the session. There must be something that can be  
done in the weborb config. The weborb forums are no help. In the mean  
time I temporarily solved my problem by identifying the user via ip  
address (which I can do in my situation).

If you find anything that works, please let me know.

---

<div class="post-metadata">

**Author:** ![fury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3bc359/32.png) [@fury](https://www.ruby-forum.com/u/fury)\
**Post date:** [April 4, 2010, 10:22am UTC](https://www.ruby-forum.com/t/current-user-authlogic-service-rb/185441/4 "2010-04-04T10:22:48Z")

</div>

On 4 April 2010 07:03, Liquid F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Unfortunately not. There are many posts regarding the wrongness of  
> passing a variable to a model for example (which makes sense)

Why do you need the current user in the model?

Colin

---

<div class="post-metadata">

**Author:** ![fury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3bc359/32.png) [@fury](https://www.ruby-forum.com/u/fury)\
**Post date:** [April 4, 2010, 1:42pm UTC](https://www.ruby-forum.com/t/current-user-authlogic-service-rb/185441/5 "2010-04-04T13:42:18Z")

</div>

> Why do you need the current user in the model?
> 
> Colin

I don’t need it in the model. I need it in a service class. When  
remoting from as3, I can only call functions defined in such a class.
