Loed
Loed

Reputation: 404

Image will not save with Paperclip and Rails 4

I'm trying to use Paperclip for uploading an image for an has many and belongs to relationship with 'pictures'

I'm certain that imagemagick etc, is correctly installed, because i've more image uploaders in this project that works, difference is that this one has an has many relation.

I'm not getting a 'Saving Attachment' in the console. So my idea is that this is completely ignored by the strong parameters.

In topicscontroller:

params.require(:topic).permit(:id, :title, :content, :active, pictures_attributes: [:image, :id, :_destroy] )

In Topic Model:

has_many :pictures, dependent: :destroy
accepts_nested_attributes_for :pictures, allow_destroy: true
validates :title, :content, presence: true

In Picture Model:

belongs_to :topic

has_attached_file :image,
:styles => { :medium => "400x400#", :thumb => "200x200#", :small => "50x50#" },
:default_url => ActionController::Base.helpers.asset_path('missing.png')

I know that there are many other topics about this, only all are rails 3 and is different in the way of setting 'attr_accessible'

Upvotes: 0

Views: 2034

Answers (1)

Loed
Loed

Reputation: 404

With version 3.5.0 of Paperclip, everything is fine for Rails 4.

Upvotes: 2

Related Questions