I'm trying to make a collection of items for options_for_select using map inside my model:
def get_products
Product.all.map { |product| [product.description,product.id] }
end
However rails is giving the error:
undefined method `map' for :get_products:Symbol
Is not possible to use map inside models?
The code in the view is:
<%= f.select_tag :product_id, options_for_select(:get_products) %>
Update
Changing the code in the view to get_products instead of :get_products gives the error:
undefined local variable or method `get_products' for #<#:0xb189c770>
options_for_select?options_for_selectthat's causing the problem -- perhaps it should beget_productsinstead of:get_products?