开发者

parameters from one page to another

开发者 https://www.devze.com 2022-12-12 22:19 出处:网络
if I have this on one htm开发者_运维技巧l.erb page <%= text_field(\"cars_\", \"name\", :size => \"30\") %>

if I have this on one htm开发者_运维技巧l.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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消