You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Paperclip Plugin
In my project I have the following three models
Post, Category, Design.
Category has many Posts
CustomDesign has many Posts.
Category has one Design
Design Model has the follolwing.
has_attached_file :header
has_attached_file :footer
I am taking in the header and footer images of design from the Posts
form.
i.e form_for @post has a fields_for :design_attributes with
file_fields for header an footer.
I have a setter method to set attributes as follows.
def design_attributes=(attributes)
if(!category.design)
design = category.build_design(attributes)
else
design = category.design
design.attributes = attributes
end
end
With the above code i am able to save the image in Design model.
But design.attributes = attributes does not seem to work.
How do i update the images in my design model?