Im using gem 'paperclip', '~> 4.3', '>= 4.3.5', and gem 'aws-sdk', '< 2.0' and i want to set expiry header for the object im saving. I am doing smth like this and this is working:
has_attached_file :image, styles: { medium: "340x280#", small: "200x200#", xs: "200x140#", thumb: "80x80#", original: "400x380#"},
s3_headers:{ 'Cache-Control' => 'max-age=31557600', 'Expires' => 1.year.from_now.httpdate }
But now i want to do
'Expires' => Model.start_date + 1.month instead of 1.year.from_now
But when i do it gives me undefined method error. I have also tried self.start_date and just start_date instead of Model.start_date, but the same error appears every time. I also tried to do
def start_date_for_object
return self.start_date + 1.month
end
and then did: 'Expires' => start_date_for_object but same error! Why cant i call the model attribute in there?
Thank you for your advice.