W
W
weare1382014-08-25 16:41:32
Ruby on Rails
weare138, 2014-08-25 16:41:32

"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

3 answer(s)
F
FanKiLL, 2014-08-25
@FanKiLL

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

S
Sergey Krasnodemsky, 2014-08-25
@Prognosticator

attach the model code
, you can also link to the screencast that you kick

Z
zion5un, 2014-09-04
@zion5un

Read about strong_parameters, version 3 screencast

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question