Thiyagu
Thiyagu

Reputation: 169

Rails4 devise paperclip: image not saved in database

Using Rails4 with devise and paperclip my image is not saved in my database. I'm getting

Unpermitted parameters: avatar

I added attr_accessible :avatar in my admin/users_controller.rb

Upvotes: 0

Views: 371

Answers (1)

BvuRVKyUVlViVIc7
BvuRVKyUVlViVIc7

Reputation: 11811

You have to use the permitted params:

# adjust the fields you need: :avatar, :first_name, :last_name,...
User.create(params.permit(:avatar))

See https://github.com/rails/strong_parameters

Upvotes: 1

Related Questions