# Help with User.find() and rendering text

**URL:** <https://www.ruby-forum.com/t/help-with-user-find-and-rendering-text/48573>\
**Category:** Rails\
**Created:** [November 18, 2005, 8:37am UTC](https://www.ruby-forum.com/t/help-with-user-find-and-rendering-text/48573 "2005-11-18T08:37:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yehweh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ba9def/32.png) [@yehweh](https://www.ruby-forum.com/u/yehweh)\
**Post date:** [November 18, 2005, 8:37am UTC](https://www.ruby-forum.com/t/help-with-user-find-and-rendering-text/48573/1 "2005-11-18T08:37:11Z")

</div>

Hi all,

I’m trying to do something for a project. Herez what im trying to do.

The user name gets passes from the view to the controller.

On line2: The user name gets displayed.  
On line 3: (If this command works the way I think it works, the sad part  
is I always get it wrong) anyways, The entry in the data base with the  
given user name gets searched and the user info gets stored in the  
variable @user.  
On line 4: Now how do i print it out? Is it a variable.

1. @some\_variable = @params[:user\_name]
2. render\_text @some\_variable.to\_s
3. @user = User.find(:all, :conditions =\> [ “user\_name = ?”,  
‘@some\_variable’])
4. render\_text @user.to\_s

I’m very sorry for this long and anoying post. I’m new to this and  
really need help!

Thanks

S

---

<div class="post-metadata">

**Author:** ![yehweh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ba9def/32.png) [@yehweh](https://www.ruby-forum.com/u/yehweh)\
**Post date:** [November 18, 2005, 9:39am UTC](https://www.ruby-forum.com/t/help-with-user-find-and-rendering-text/48573/2 "2005-11-18T09:39:31Z")

</div>

Sushruth blah wrote:

> variable @user.  
> On line 4: Now how do i print it out? Is it a variable.
> 
> 1. @some\_variable = @params[:user\_name]
> 2. render\_text @some\_variable.to\_s
> 3. @user = User.find(:all, :conditions =\> [ “user\_name = ?”,  
> ‘@some\_variable’])
> 4. render\_text @user.to\_s

The method you’re after is @user.inspect. @user is an instance variable  
of class (I presume) User.

---

<div class="post-metadata">

**Author:** ![yehweh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ba9def/32.png) [@yehweh](https://www.ruby-forum.com/u/yehweh)\
**Post date:** [November 19, 2005, 10:55pm UTC](https://www.ruby-forum.com/t/help-with-user-find-and-rendering-text/48573/3 "2005-11-19T22:55:42Z")

</div>

> The method you’re after is @user.inspect. @user is an instance variable  
> of class (I presume) User.

Yeah,I wanted to use @user.inspect.

Thanks.
