Rails: ActiveModel::ForbiddenAttributesError
You passed raw params to new/create/update, but strong parameters require permitting attributes first.
ActiveModel::ForbiddenAttributesError (ActiveModel::ForbiddenAttributesError)ForbiddenAttributesError strong parametersUnpermitted parameter: :nameActiveModel::ForbiddenAttributesError in UsersController#create Meaning
Use params.require(:user).permit(:name, :email) (a private user_params method), then User.create(user_params). params.to_unsafe_h bypasses protection — avoid it. In APIs with JSON make sure the root key matches require.
Common causes
User.new(params[:user])withoutpermit- Permitted list missing a nested hash/array (
permit(tags: [])) - Using
paramsinstead ofuser_paramsin update - Root key mismatch (wrap_parameters)
- Upgrade from Rails 3
attr_accessible
⚡ Quick fix
def user_params; params.require(:user).permit(:name, :email); end- Use
User.create(user_params) - Permit nested:
permit(:name, address: [:street, :city], tag_ids: [])
Detailed fix by platform
Rails
params.require(:post).permit(:title, :body, tag_ids: [])
How to diagnose
- Call — Uses permitted params?
- Nested — Permitted?
- Root — Correct key?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- "x" can't be opened because it is from an unidentified developer macOS: “app” can’t be opened because it is from an unidentified developer
- ActionController::ParameterMissing: param is missing or the value is empty Rails: ActionController::ParameterMissing: param is missing or the value is empty: user
- ActiveRecord::AssociationTypeMismatch Rails: ActiveRecord::AssociationTypeMismatch: User(#1234) expected, got "42" which is an instance of String(#5678)
Most viewed in Ruby / Rails
- ActiveRecord::PendingMigrationError Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate
- ActionController::InvalidAuthenticityToken Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity)
- undefined method for nil Ruby: NoMethodError: undefined method `x' for nil (nil:NilClass)
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026