Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
How do you set paperclip expiry header for aws that depends on the object's date attribute

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.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!