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 Ruby on Rails Forms Form Builders and Rails Updating The Views

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

No code or explanation on how to fix the error

Dear Jason Seifer ,

Around minute 2:43 there's an error (second one, with nil class) and the video just cuts to you saying that "we've got that fixed". But we don't know how it was fixed. What was done? It's not in the video and there is no code for download to see your version, so the user is left stranded with non-functioning code in the editor. I had to look for code under further videos, but there are many more changes there already. Could you maybe add some teacher's notes under this video to show how the builder was changed to get rid of both errors?

I see this didn't come up so far on the forum, I guess not many users venture that far into odot courses while coding along with you.

Thanks for pointing this out! I have this course pinned to my home page to go through soon, but I'm not quite there yet. This would have made me a little crazy if I'd discovered it without anything to help in the forums. Now I know to hold off awhile.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

The only way to deal with it now is to go two videos forward to get the source code and check the differences. And I'm afraid it's not the only inconsistency. There seem to be some differences between the code you're doing along with the guys in the videos and the code that they start with in the next course. Just don't be surprised if they have something more or different at some point and you don't remember doing it in one of previous courses (I think there are 6 or 7 in total) :). The whole series is doable, I finished the whole app yesterday and I love it - the design and the features they taught us (except for mailers - they don't work at all, since that would require further configuration and binding to an email account - it's something on my to-do list now, making it work properly). But there isn't enough explanations at times and some inconsistencies may pop up. And Bootstrap is sooo last year for me. I'm in love with Foundation now ;).

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Also, Keri Nicole , make sure you're doing the Odot courses in the proper order. Go to Library, select Ruby and look from bottom up, from right to left.The series starts with Building Todo App and ends with Polishing Rails App.

Oh! That's important, huh? I did all the Odot courses in the Rails Development Track but haven't branched out to the free standing courses yet. Good to know I should be looking from the bottom up when I get there, thanks! :)

1 Answer

This is a straightforward fix........and I believe his explanation should get you there.....

I simply called

      wrapper_options = { wrapper_classes: ""}

to ensure that wrapper_options was always initialized.

Therefore:

     def text_field(attribute, options={})
     options[:label] ||= attribute
     label_text ||= options.delete(:label).to_s.titleize
     label_options ||= {}
     wrapper_options = { wrapper_classes: ""}
           if errors_on?(attribute)
          wrapper_options = { wrapper_classes: "error"}
         end
          wrapper(wrapper_options) do
        label(attribute, label_text, label_options) +
        super(attribute, options) + errors_for_field(attribute)
        end
        end