Answer the question
In order to leave comments, you need to log in
Why isn't Paperclip working?
Hi friends! Please help me with this animal.
Migration
create_table :post_attachments do |t|
t.attachment :photo
t.timestamps
class PostAttachment < ActiveRecord::Base
belongs_to :post
has_attached_file :photo, :styles => { :mini => "260x180#", :normal => "800x400#" }
end
has_many :post_attachments
accepts_nested_attributes_for :post_attachments
params.require(:post).permit(:title, :body, post_attachments_attributes: [:id, :photo]
Unpermitted parameter: post_attachments
def new
@post = Post.new
@post.build_post_attachments
end
undefined method `build_post_attachments' for
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question