views:

29

answers:

1

Hi

I am trying to use hpricot in a controller. I would like to pass this value to a html.erb page so I can display it on the screen

So I wrote this:

session[:allcars] = (doc/"td.car_title/text()")

but this gives an error

when I tried this:

puts (doc/"td.car_title/text()")

this printed the cars into the console.

So I can't understand what I'm doing wrong :S

Thanks

+1  A: 

The easiest way to pass variables from a controller to a view is to use a member variable.

@allcars = (doc/"td.car_title/text()")

Then in your html.rb page, get the value using @allcars.

Jonathan Julian