I am trying to get the current date inside my rail model as follows:
Inside Photo.rb
Paperclip.interpolates :prefix do |attachment, style| :today_date => Date.today.to_s "#{:today_date}/#{attachment.instance.image_file_name}" end
When I send a photo to the server from the client, I get an error message and the next console output on the server. This indicates that there is a problem with the Date function.
Server Console:
Started POST "/photos.json" for 127.0.0.1 at 2013-02-20 13:47:35 -0800 13:47:35 web.1 | 13:47:35 web.1 | SyntaxError (/Users/AM/Documents/RailsWS/test/app/models/photo.rb:22: syntax error, unexpected tASSOC, expecting keyword_end 13:47:35 web.1 | :today_date => Date.today.to_s 13:47:35 web.1 | ^): 13:47:35 web.1 | app/controllers/photos_controller.rb:1:in `<top (required)>'
What am I doing wrong? How to get the current date in this variable?
thanks
source share