views:

32

answers:

2

Hi

if I have this on one html.erb page

<%= text_field("cars_", "name", :size => "30") %>

and

def find
  @car = Car.new(params[:car_])
  carsearch = @car.name
....

why is the carsearch coming as nil?

+2  A: 

Maybe because the field is cars_ (plural) and the find is using car_ (singular)?

ScottJ
+1  A: 

If you are trying to use carsearch on an erb template, then you need to make it an attribute instead of a variable, it should be @carsearch.

Chris Johnston