문제

I have a Rails 4 app which works well in localhost in both dev and production mode. When I deploy my app to Heroku, it does load for user to sign up. But at the sign up page, select tag seems not to load params from controller. ( which is @universities )

View:

<%= f.select :university_id, options_from_collection_for_select(@universities,"id","name"), {include_blank: true}, {class: "form-control selectpicker show-tick inline", data: {width: 'auto'}} %>                  

Controller:

@universities = University.all

The sign up page looks like this: Clicking at the selection box does nothing.

enter image description here

Does anyone have similar problems like this? Thanks in advance.

Update #1: Turn out the problem is bootstrap select somehow not opening.

도움이 되었습니까?

해결책 2

Finally I got it working by include this following line in application.js file:

//= require bootstrap-sprockets

and these into application.scss:

@import "bootstrap-sprockets";
@import "bootstrap";

I guess this issue is related to bootstrap-sass gem.

다른 팁

Why don't you try using a collection_select:

<%= f.collection_select :university_id, University.all, :id, :name %> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top