Ruby on Rails Friday, June 29, 2012

I think you are using gsub on symbol which is the reason you are thrown this error. Pass the string to the function instead of symbol:

<%= dropdown_tags "sort_criteria", 'Select Criteria',
   %w(Category Status Amount-High Amount-Low) %>

On Sat, Jun 30, 2012 at 3:52 AM, Eastside Developer <lists@ruby-forum.com> wrote:
Environment: Rails 3.2.3

This is my first attempt at doing a dropdown menu in a Rails
application. I tried looking for help on the topic, but what complicated
things is that the term dropdown menu is used for actual dropdown menu
(page menu), as well as what is dropdown lists, form options, form
selections, etc.

I found a pointer to https://github.com/dkeskar/rails-jquery-dropdown,
and following the instructions, I downloaded jquery_dropdown_helper.rb:
) and placed it in /lib

In my Gemfile, I have the following:

gem 'jquery-rails'

I downloaded jquery_dropdown_helper.rb:
https://github.com/dkeskar/rails-jquery-dropdown) and placed it in /lib

In _header.html.erb, I have the following:

<% require 'jquery_dropdown_helper' %>
....
<%= hidden_field_tag :sort_criteria %>
<%= dropdown_tags :sort_criteria, 'Select Criteria',
   %w(Category Status Amount-High Amount-Low) %>

Here's the error code I'm getting:

undefined method `gsub' for :sort_criteria:Symbol

Any ideas?

Attached is the jquery_dropdown_helper.rb

Attachments:
http://www.ruby-forum.com/attachment/7541/jquery_dropdown_helper.rb


--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.




--
Thanks, 
Aash

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.

No comments:

Post a Comment