Wednesday 15 January 2014

ruby on rails - How do I get simple_form and bootstrap to work together? -



ruby on rails - How do I get simple_form and bootstrap to work together? -

i'm using simple_form generate forms in rails application. i'm wanting utilize bootstrap these forms. i've installed next gems , added them gemfile... (1)simple_form, (2)twitter-bootstrap-rails. finally, per instructions on simple_form git page ran, rails generate simple_form:install --bootstrap.

after running bundle install installed , server runs. forms still not displaying correctly class "form-control".

form

= simple_form_for @user, html: { multipart: :true, class: "form-horizontal" } |f| = f.input :headshot_image, as: :file = f.input :remote_headshot_image_url, placeholder: "image url" = f.input :first_name, required: true = f.input :middle_name = f.input :last_name, required: true

i able "work" 2 different methods (neither of believe correct). first can add together , class: "form-control" each input, or can add together simple_form_for :defaults => { :input_html => { :class => "form-control" } }. former kinda defeats purpose believe, , latter works, applies class file input not ideal.

is there setup step missed? or have done incorrect. if need provide more info or left out please allow me know. thanks!

probably forgot adding bootstrap assets application.css file simple_form readme has next line:

you have sure added re-create of bootstrap assets on application.

ruby-on-rails twitter-bootstrap ruby-on-rails-4 simple-form

No comments:

Post a Comment