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

Need help with Generating the Devise Views.

So, i have been following a long with the videos and everything that Jason was doing. All was going great until i had to add first, last and profile name. Now every time i try and refresh and go to user/sign_up i get this error:

NoMethodError in Devise/registrations#new

Showing C:/Sites/projects/treebook/app/views/devise/registrations/new.html.erb where line #6 raised:

undefined method `first_name' for #<User:0x4391ac0> Extracted source (around line #6):

3: <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> 4: <%= devise_error_messages! %> 5: <div><%= f.label :first_name %><br /> 6: <%= f.text_field :first_name %></div> 7: 8: <div><%= f.label :last_name %><br /> 9: <%= f.text_field :last_name %></div> Rails.root: C:/Sites/projects/treebook

I have tried everything i could to fix it. I have double and triple check that everything was spelled right and match up exactly with what Jason had on the screen. i have even looked on the forum for answer from people with the same problem and nothing works. I don't know what i am over looking can some on please help me.

Thank you.

Can you break your code into code snippets to it's easier for us to read?

what are code snippets? i am super new to all of this.

Click the "Markdown Cheatsheet" link right under the text box (see here). You'll see options for formatting your forums posts/comments/replies. Let me know if that's not clear.

1 Answer

it sounds like your database is missing the first_name, last_name, and profile_name fields so rails doesnt recognize the symbols. when you generate the devise views, it should also generate a migration file called devise create or something along those lines in the db/migrate directory. Check and make sure that you added the first_name, last_name and profile names to the database in that migration file, and then run

$ rake db:migrate

Does it give you an error at this point when you try and migrate?