views:

9

answers:

1

I'm using rails' select helper on my page, dynamically populated with Categories on a page showing news articles. Changing the select should refresh the page and show news articles for the selected category. I'm storing the category id in the session. How do I make my select show persist the correct selected value? Currently trying this but it doesn't work:

  <%= select "session", "news_category_id", 
             @categories.collect {|c| [ c.name, c.id ]}, 
             {:prompt => "Filter news by company"}
  %>
A: 

The problem was that the value of news_category_id was a string.../facepalm

Trevor Hartman