Pergunta

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.

Foi útil?

Solução 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.

Outras dicas

Why don't you try using a collection_select:

<%= f.collection_select :university_id, University.all, :id, :name %> 
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top