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 trialJames Whiting
39,124 Pointsattr_accessible issue in module's user.rb file
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :profile_name
I have to comment this out to get rails server to work. Why? and how do I fix this.
6 Answers
Nick Fuller
9,027 PointsCan you post the error message as well as the file?
James Whiting
39,124 PointsTHE ERROR when loading localhost:3000/ :
NoMethodError in StatusesController#index undefined method `attr_accessible' for #<Class:0x007fdc779a99e8>
Extracted source (around line #2):
class Status < ActiveRecord::Base attr_accessible :content, :user_id
belongs_to :user
end
Rails.root: /Users/MacHD/Projects/treebook
Application Trace | Framework Trace | Full Trace
app/models/status.rb:2:in <class:Status>'
app/models/status.rb:1:in
<top (required)>'
app/controllers/statuses_controller.rb:7:in `index'
Request
Parameters:
None
THE FILE 'status.rb':
class Status < ActiveRecord::Base attr_accessible :content, :user_id
belongs_to :user
end
Nick Fuller
9,027 PointsAre you using rails 4? or Rails 3?
James Whiting
39,124 PointsRails 4.1.1
Nick Fuller
9,027 PointsRails 4 introduced strong_parameters instead of using attr_accessible
So you're calling a method that no longer exists
James Whiting
39,124 PointsOK. I will look into it. Thanks so much.