Uh oh, Error solving

undefined method `stringify_keys’ for [[“Craved”], [“Whole Sale”]]:Array
I did this earler in the script how come now it’s yealling?

<% catas = Category.find(:all, :order=> “name”).map {|u| [u.name]} -%>

Catagory:
<%= select 'item', 'cata', catas %>

<% mcatas = SubCategory.find(:all, :order=> “name”).map {|u| [u.name]}
-%>

Sub cata
<%= text_field 'item', 'sub_cata', mcatas %>

What’s wrong with this?

You want
<%= collection_select, ‘item’, 'cata, Category.find(:all), ‘id’, ‘name’
%>
John wrote:

undefined method `stringify_keys’ for [[“Craved”], [“Whole Sale”]]:Array
I did this earler in the script how come now it’s yealling?

<% catas = Category.find(:all, :order=> “name”).map {|u| [u.name]} -%>

Catagory:
<%= select 'item', 'cata', catas %>

<% mcatas = SubCategory.find(:all, :order=> “name”).map {|u| [u.name]}
-%>

Sub cata
<%= text_field 'item', 'sub_cata', mcatas %>

What’s wrong with this?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs