Answer the question
In order to leave comments, you need to log in
"NoMethodError" where to pick?
I'm now studying rails on screencasts from rubyscreencasts, it came to adding properties to the model and the console shines "NoMethodError: undefined method `attr_accessible' for Item"
I understand that this is due to differences in rails versions? what should I do?
Answer the question
In order to leave comments, you need to log in
Rails version 4 removed attr_accessible now uses a different approach from mass assignment
Read Strong Parameters
or an example
class PersonsController < ApplicationController
def create
Person.create(person_params)
end
private
def person_params
params.require(:person).permit(:name, :age)
end
end
attach the model code
, you can also link to the screencast that you kick
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question