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

Generating the Devise Views: undefined method 'first_name' for #<...>

I'm having a reoccurring problem I was hoping someone could help with. When working through the 'Generating Devise Views' lesson, I keep getting the following error after I delete my initial user ID and try to create a new one: undefined method 'first_name' for #<...>
<%= f.text_field :first_name %></div> The error is emanating from the app/views/devise/registrations/new/html.erb. If I remove the t.fields for first_name, last_name, and profile_name, it works just fine. I'm also using Ruby 4.0, so I wasn't able to use 'attr_accessible' in the user.rb folder, so I think that may have something to do with it. I substituted it with 'configure_permitted_parameters' in the application_controller.rb folder, which seemed to work ok until I tried to create a new user ID. Any thoughts? Thanks!

2 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

That's a strange error, christopher sunsong. Can you paste a link to your code up on GitHub so we can try and help troubleshoot?

Hey Jason, I'm having a similar problem with my code. Before I was getting the: first_name undefined, and now after creating the method: full_name, I'm getting the same error. It seems like my first_name, last_name and profile_name are not being stored in the database as well.

Is this happening because I'm using Rails 4?

Any help would be greatly appreciated. Here's my link to my github repo: https://github.com/Joshmantis/SocialMed

I seem to be having the same issue and cannot figure out what the issue is. :first_name :last_name and :profile_name are defined in the device_create_users.rb migrate file.

https://github.com/brianpel/treebook

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

Hey Josh Flowers and Brian Pelowski those are Rails 4 errors. I'd recommend following along with our Rails 4 project and see if you can spot the differences. It's best to work along with this project using the latest Rails 3.2 release.

Jason Seifer - Thanks for pointing out the to-do list rails 4 tutorial! I was really pulling my hair out with the treebook tutorial, heh. :) I might go back and get rails 3 though...