Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Marcus Tisäter
Marcus Tisäter
4,886 Points

Simple_form bootstrap


I've installed the Simple_form correctly and everything seems to be fine, but the forms are still not working with bootstrap.

Here is my code:

<%= simple_form_for(@status, html: {class: "form-horizontal"}) do |f| %>  
  <% if @status.errors.any? %>
<div id="error_explanation">
  <h2><%= pluralize(@status.errors.count, "error") %> prohibited this status from being saved:</h2>

  <% @status.errors.full_messages.each do |msg| %>
    <li><%= msg %></li>
  <% end %>
   <% end %>

      <%= f.input :user_id %> 
   <%= f.input :content %>
   <div class="form-actions">
    <%= f.button %>
<% end %>

So nothing of this seems to work, my status page dosen't turn up horizontal, and the f.button gets an error on the page Any clues? Thanks

1 Answer

hi Marcus, you f.button is wrong it should be :

    <%= f.input :content %>
    <div class="form-actions">
       <%= f.button :submit %>

make sure that bootstrap is loaded correctly, if it was try re-generating it with the bootstrap option on:

 rails generate simple_form:install --bootstrap

then generate your forms again if you get stuck refer to simple_form and bootstrap documentation: https://github.com/plataformatec/simple_form