5

I've read many other related questions and just cannot get this gem to work:

https://github.com/tsechingho/chosen-rails

as the README says, I have

-included *= require chosen in my application.css -included //= require chosen-jquery in my application.js 

In addition, I have tried adding the followin to the bottom of my application.js file:

jQuery(function($){ $('.chzn-select').chosen(); }); 

I've also replaced .chzn-select with #user_education_ids and #user_school_ids based on my model and view:

<% @schools = Education.all.map { |e| [ e.school, e.school ] } %> <%= select_tag "school_ids", options_for_select((@schools), params[:education_id]), { :include_blank => true, :multiple => true } %> 

I've tried adding , :class=>'chzn-select' to the end of :multiple => true, no luck

(A User has many Educations, as well as many schools through educations)

Not sure why this is giving me so much trouble, but it is. Help is very much appreciated!

1 Answer 1

1

I know this is a little late, but I had a problem getting it to work as well.

I got it to work by moving the line "gem 'chosen-rails'" outside of the :assets block in the Gemfile (I noticed your comment on the associated Railscast, where Ryan put it in the :assets block, so I'm assuming you did as well).

I'm not sure if that's the "right" solution, or what the side effects might be, but it appears to be working now.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.