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 trial

Ruby Build a Simple Ruby on Rails Application Customizing Forms Installing simple_form

form-horizontal not working

Hi there,

I am following along this tutorial, which is great by the way.

So far, I have not been able to get the horizontal form layout.

I am using Rails 4 and Ruby 2.0.

Here is the code from my _form.html.erb file:

'''<%= 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 :content %> <div class="form-actions"> <%= f.button :submit %> </div> <% end %> ''' Any idea what is going wrong?

Thank you.

7 Answers

Chris Dziewa
Chris Dziewa
17,781 Points

I had the same problem. I have postponed the Ruby track here to learn the basics elsewhere until I know enough to troubleshoot this track. It is outdated and one thing that should be mentioned here is that simple form is not fully compatible with Bootstrap 3. I have heard of workarounds but when I tried I was unsuccessful. Just try a Google search for simple form Bootstrap 3 workaround. If you can trudge through though you will gain the kind of experience needed that will be useful in a real life situation since dealing with software version differences is a normal part of the job. You could do Ruby foundations first which will help you in your troubleshooting later.

Chris Dziewa
Chris Dziewa
17,781 Points

I would recommend this awesome and well-known rails tutorial by Michael Hartl. It is long reading but great step by step examples that teach you rails from the ground up and even some basic Ruby. I'm on the 5th chapter out of 12 and it's great. When I finish there, I would like to come back and finish this Rails track as well as the Rails track at Code School.

Hi Chis, Hi Laura,

Thanks for your respective comments.

Michael Hartl's tutorial is actually next on my apps-to-do list.

For the moment, I am quite determined to stick with this Treehouse course.

I have asked the same question to my local Ruby community: if I get a working answer, I will let you know guys.

Have a good one,

Thibaud

Chris Dziewa
Chris Dziewa
17,781 Points

Sounds good! Best of luck on the track, Thibaud!

Laura Cressman
Laura Cressman
12,548 Points

I'm blatantly stalking this post, but thanks for the link Chris! Definitely seems like it's worth checking out. Are you just using the free web version of the book, or did you buy any of the upgrades?

Chris Dziewa
Chris Dziewa
17,781 Points

Haha no worries! I'm doing the free version of the book since I have a subscription here and at Code School I wanted to save some money. Before I came to Treehouse about 5-6 months ago I had studied Python programming over at Udacity.com for about 8 months and began making web apps there but didn't finish more than a couple because the learning curve was high by about week 3 of their intermediate courses. I had also done javascript at codecademy.com for a while and a full on Python course at coursera.org based around object oriented programming. I think because of this, I am now in the position to understand the tutorial without the need for the paid extras. I still am taking my time with it though!

If it is in the budget I would think it would be great to look over an experienced programmer's shoulder to learn!

Laura Cressman
Laura Cressman
12,548 Points

It would be great, but I totally get the saving money idea, since I'm a senior in college :P I am using Treehouse and Code School though, and think they are pretty helpful. If you come up with any other suggestions to learn that are relatively cheap, though, I would be happy to hear them :)

Chris Dziewa
Chris Dziewa
17,781 Points

I found Ruby Monk to be great for learning the Ruby language and found that the ruby foundation course here complemented it well. I also just started trying Ruby Koans which is a learning adventure so to speak done in the terminal based on test driven development. Although this wasn't recommended by Michael Hartl until the end of the 4th chapter. It might be helpful to wait until then to try that one. I have heard Railscasts is really good but have yet to try it. Those are about all the things I know about for Ruby right now.

Laura Cressman
Laura Cressman
12,548 Points

Thanks Chris! Both seem like great resources. For what it's worth, here's a very beginner type of site my friend recommended: https://pine.fm/LearnToProgram/?Chapter=00. This is likely too easy for you, but if someone else is reading this by chance, it could be helpful.

Speaking of learning curves, I think that codecademy.com is doing a fine job teaching the basics of Ruby step-by-step. It turned to be a good introduction to learning Rails on treehouse.

Gwenaël Magnenat
Gwenaël Magnenat
14,617 Points

There seems to be some recent changes on the simple form github repository. https://github.com/plataformatec/simple_form

On the gemfile of the example application (https://github.com/rafaelfranca/simple_form-bootstrap) you can actually see they are using rails 4.1.0, bootstrap-sass 3.1.1.0 and simple_form 3.1.0.rc1

There is examples in the views and form-horizontal works like it should.