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

No method Error!

I am getting a new method error for the attr_accessible part, I did do the RVM thing to 1.9.3. However, I did have to add the attr_accessible part in. This is the error.

http://gyazo.com/24d21f86a0f1746cbe01dad0bd39cfaa

Then here is my code to the 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

attr_accessible :first_name, :last_name, :profile_name

end

2 Answers

Stefan Legg
Stefan Legg
3,168 Points

Are you using Rails > 4.0?

From the Rails Guides:

Rails 4.0 has removed attr_accessible and attr_protected feature in favor of Strong Parameters. You can use the Protected Attributes gem for a smooth upgrade path.

Thanks, I'll let you know if this works!

Edit: It works!

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Not enough information. What version of Rails? What does this relate to (course? video?).