0
votes

In my Rails project I have bootstrap-sass (3.3.6, 3.3.4.1) installed. I also added @import "bootstrap"; to my application.css.scss.

Now I am able to use Bootstrap classes in my project just fine.

Now I want to use Bootstrap by default on all forms. So I added the gem and installed simple_form

rails generate simple_form:install --bootstrap

From what I understand this form here should now be displayed with Bootstrap styles, but it doesn't

<section class="content">
    <div class="box">
        <div class="box-body">

            <%= simple_form_for :ride, url: order_path do |f| %>

            <p>
                <%= f.label :client %><br>
                <%= f.text_field :client %>
            </p>

            <p>
                <%= f.submit 'Adicionar', :class => 'btn btn-primary' %>
            </p>

            <% end %>

        </div>
    </div>
</section>

The button gets styled since I am adding the classes manually, but the input fields don't. I added the code that wraps this form, just to make sure to be complete.

Anyone an idea on what I am doing wrong?

1
have you tried removing the <p> tags? - Sander Garretsen

1 Answers

0
votes

Its possible that the default version of simple_form is not completely working with Bootstrap 3. try to change the simple_form gem to

gem 'simple_form', '~> 3.1.0.rc1', github: 'plataformatec/simple_form', branch: 'master' 

or

gem 'simple_form', '~> 3.2', '>= 3.2.1'

and then restart the rails server and see if it works.