Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

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

Simple_form bootstrap

Hello,

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>

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


      <%= f.input :user_id %> 
   <%= f.input :content %>
   <div class="form-actions">
    <%= f.button %>
  </div>
<% 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 %>
    </div>

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