0

I'm having this error on my app.

ActiveModel::ForbiddenAttributesError

I'm using gem 'activeadmin', github: 'activeadmin', gem 'rails', '4.1.7'

Even when all of the listed attributes are included in the strong parameters on my Active Admin Model.

Model

ActiveAdmin.register User do

permit_params = :prefix, :firstname, :lastname, :password, :email, :membership_code, :birthdate, :contact_number, :location, :active, :confirmed, :remember_token, :town, :province

Error

Request

Parameters:

{"utf8"=>"✓",
 "authenticity_token"=>"xVA04SdSTDLrwC088FCTRm9fr62z+fgs6wJc0yNn/NU=",
 "user"=>{"prefix"=>"mzxklmcklzmklMAKMDAKLSDMASKLDM",
 "firstname"=>"KLMSDKMSADKLAMS",
 "lastname"=>"MKDSMFKSLDMFK",
 "password"=>"[FILTERED]",
 "email"=>"KLMFDKDSMFKLSDMFKL",
 "membership_code"=>"MKDFSMKLSDMFK",
 "birthdate(1i)"=>"2009",
 "birthdate(2i)"=>"2",
 "birthdate(3i)"=>"1",
 "contact_number"=>";WE,
LA;SD,
",
 "location"=>",
LDSF,
LSDF,
SL;",
 "active"=>"1",
 "confirmed"=>"1",
 "remember_token"=>"DSL;FSDFL",
 "town"=>"FDMSKLFM",
 "province"=>"FMSDFLKS"},
 "commit"=>"Create User"}

Any help?

UPDATED

At first, I thought it was the birthdate causing the error(it contains 3 parameters and not 1).
but I also have a different resource which also has the birthdate in it and it actually worked.

Community
  • 1
  • 1
olleh
  • 1,248
  • 5
  • 16
  • 43

1 Answers1

0

I had a typo on the permit_params declaration. I just removed the equal sign.

wrong:

permit_params = :prefix, :firstname, :lastname, :password, :email, :membership_code, :birthdate, :contact_number, :location, :active, :confirmed, :remember_token, :town, :province

right:

permit_params :prefix, :firstname, :lastname, :password, :email, :membership_code, :birthdate, :contact_number, :location, :active, :confirmed, :remember_token, :town, :province

Thanks! @nistvan

olleh
  • 1,248
  • 5
  • 16
  • 43