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

General Discussion

Ruby on rails simple form problem

on this page Programming Build a Simple Ruby on Rails Application Customizing Forms Adding Styling <-

<%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: "well"}) do |f| %>

is returning the class name "simple_form well" but its not adding the gray box around the input fields like the video.

Ideas?

4 Answers

Are you certain you have bootstrap properly configured? Well is class specific to bootstrap.

Try viewing the source of your page and ensuring the html rails is spitting out on the form dies indeed have

class="well"
Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Try also using the class: 'well form form-horizontal' or 'well form form-vertical' to make it look a little more like a form.

I tried using your suggestion, but the form still looks odd. When Jim instructs us to use simple_form's button <%= f.button :submit %> the button doesn't format to the bootstrap/simple_form button. I can't get it to display properly in vertical either, with the labels next to its respective area.

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

Sorry to hear! Can you post a screenshot of the problem in a new thread?

I actually can't cause the code has been messed up, as I followed through with the project. Devise has been updated to no longer accept attr_accessible, and has replaced it with strong paramaters. I tried to follow the project as close as possible, doing what I can without getting errors, but now I am lost and have no idea how to fix it. SyntaxError in Statuses#index Showing C:/Users/user/treebook/app/views/layouts/application.html.erb where line #20 raised:

C:/Users/user/treebook/app/views/layouts/application.html.erb:20: syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '(' ...roy_user_session_path, method :delete );@output_buffer.safe_... ... ^ Extracted source (around line #20): 17 18 19 20 21 22 23

            <ul class="nav pull-right">
                <% if user_signed_in? %>
                <li><%= link_to current_user.full_name, edit_user_registration_path %></li>
                <li><%= link_to "Log Out", destroy_user_session_path, method :delete %></li>
                <% else %>
                    <li><%= link_to "Register", new_user_registration_path %></li>
                    <li><%= link_to "Log in", new_user_session_path %></li>

Trace of template inclusion: app/views/layouts/application.html.erb

Rails.root: C:/Users/user/treebook

That's the last error I got before I decided to stop with the rails project.

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

That should read "method: :delete" rather than "method :delete". I think that's the issue right here.

Well that's one issue down. But now it says <% if user_signed_in? %> is an undefined method... I'm pretty sure after this issue is resolved, another will pop up, so rather than waste more time, I'm just going to keep following through with the project, without any expectations.

it's returning this.

form accept-charset="UTF-8" action="/users/sign_in" <b>class="simple_form well"</b> id="new_user" method="post" novalidate="novalidate"

I accidentally ran the simple form install without the bootstrap option. then I ran it again with the bootstrap option.

is there a way to delete them both and reinstall simple form with bootstrap maybe?

awesome. I found a missing ">" after the span4 div. all fixed now.