Help with User.find() and rendering text


#1

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


#2

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.


#3

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.