# Send loggedin user as action paramaters

**URL:** <https://www.ruby-forum.com/t/send-loggedin-user-as-action-paramaters/189872>\
**Category:** Rails\
**Created:** [June 9, 2010, 10:13am UTC](https://www.ruby-forum.com/t/send-loggedin-user-as-action-paramaters/189872 "2010-06-09T10:13:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![swetha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@swetha](https://www.ruby-forum.com/u/swetha)\
**Post date:** [June 9, 2010, 10:13am UTC](https://www.ruby-forum.com/t/send-loggedin-user-as-action-paramaters/189872/1 "2010-06-09T10:13:10Z")

</div>

Hi ,

I am having a problem in sending loggedin user and also his website  
name as paramters .So that he can have preview of that.

Relationship : I have 2 models user an website and relationship  
between them is  
user :has\_one website

So when i click on \<%= link\_to  
‘preview’ ,:controller=\>‘home’,:action=\>‘index’ %\> , in this i need to  
send respective user who has logged in and also his corresponding  
website. SO how can i send these values as paramters.

---

<div class="post-metadata">

**Author:** ![swetha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@swetha](https://www.ruby-forum.com/u/swetha)\
**Post date:** [June 9, 2010, 10:21am UTC](https://www.ruby-forum.com/t/send-loggedin-user-as-action-paramaters/189872/2 "2010-06-09T10:21:22Z")

</div>

On 9 June 2010 09:12, swetha [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So when i click on \<%= link\_to  
> ‘preview’ ,:controller=\>‘home’,:action=\>‘index’ %\> , in this i need to  
> send respective user who has logged in and also his corresponding  
> website. SO how can i send these values as paramters.

That rather depends on how you are handling logging in. Possibly you  
have stored the current logged in user id in the session? If so then  
you do not need to pass it, just get it out of the session. Once you  
have the user then you can get his website as @user.website or  
similar.

Colin
