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 Issue with "Generating the Devise View"

Hey guys,

So I'm going out of my comfort zone and decided to Ruby on Rails and the "Build a Simple Ruby on Rails Application" course. So far everything was working perfectly until I went and started working on the user.rb file.

The error I get is a NoMethodError with the following message

 # Setup accessible (or protocol) attributes to the model
  attr_accessible :email, :password, :password_confirmation, :remember_me,
                                :first_name, :last_name, :profile_name
end
Rails.root: /Users/stuCowley/Dropbox/Treehouse/Ruby/Build a Simple Ruby on Rails Application/treebook

I have followed along with the video and entered the terminal prompts exactly how Jason Seifer had done.

Here is what I have in my user.rb file:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protocol) attributes to the model
  attr_accessible :email, :password, :password_confirmation, :remember_me,
                                :first_name, :last_name, :profile_name
end

With my inexperience with ruby I have no idea if my code is wrong or if I'm experiencing a compatibility issue.

Thanks in advance for any advice or help on fixing this!

Stu : )

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

This is one of many problems you will encounted in this course. The videos are very old and use very outdated versions of gems, including Rails. As far as your immediate problem is concerned, you can read my blogpost dedicated to this exact issue: http://mczuchnowski.github.io/tutorials/2015/03/15/devise-and-strong-parameters/ . However, be aware that even if you solve this, there will be a lot more stuff in this course that won't work at all and you will have to look for fixes and solutions.

I knew things were going to go wrong when we started using Bootstrap v2. I might dump what I'm doing and do an updated/current Ruby course.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Yeah, you could move to the Todo App course. It is a bit more modern, but focuses more on TDD, just giving you a heads-up ;).

Cool, thanks for that mate. :)