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! While you're at it, check out some resources Treehouse students have shared here.
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 trialMarcus Tisäter
4,886 PointsSimple_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
Nima Shariatian
1,760 Pointshi 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
Jonathan Seligsohn
23,116 PointsJonathan Seligsohn
23,116 PointsTo fix the button, see Jason's comments here: https://teamtreehouse.com/forum/adding-styling-using-simple-form-and-buttonto