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 Creating Relationships

Marc Burt
Marc Burt
9,828 Points

Undefined method / nil error

I've just spend a few hours working through an error I had when attempting this video. There's a very good chance others will get stuck here too.

The error is caused because I'm using Rails 4.0.3 (didn't think to install an earlier version). I noticed by reading the console whilst using my site that I was getting multiple 'unpermitted variable' errors, when setting the status user ID and when entering first name, last name and profile name when signing up - I didn't realise these were not being saved since the user was still created.

I thought installing the protected_attributes gem would have solved the problems with Rails 4's Strong attributes but it turns out it didn't.

I eventually found this: https://teamtreehouse.com/forum/strongparameters-and-treebook on the forum, Robert Goddards's post about the application_controller.rb file was what fixed it.

1 Answer

Rodrigo Soares
Rodrigo Soares
2,460 Points

I did install the gem 'protected_attributes' like you mentioned above and it worked just fine for me.