Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda