simple rails app- how to?


Customer.find() will return a Customer object containing all the attributes of your Customer model (e.g. name, number, phone, email).

After you assign Customer to an instance variable (@customer = Customer.find(:all, :conditions => "id = cookies[:customer_id]")), you may bet the name in your view template using this embedded ruby:

Welcome <%= %>

Hope this helps!

Dave Dumaresq.


Thanks- That was indeed the problem. The next snag that I am
having is

passing a value from the controller into the view. For example,
I want

to pull the firstName of the logged in user and then say something

“welcome back <customer_name>”

In the controller I load in the customer info using Customer.find(:all,

:conditions => “id = cookies[:customer_id]”)

I get the right customer and i am able to extract the firstName from

returned array. But I can’t use it in my view.

What simple concept am I not getting. I thought that an field
in the

controller was available in the view. Is this a scope issue?
I am

assigning the value inside the def confirm method. But I need
the name

in the confirm view also.

Posted via