I am trying to change the basename (filename) of photos:
In my model I have:
attr_accessor :image_url, :basename has_attached_file :image,
If you are assigning the file directly you can do this:
photo.image = the_file photo.image.instance_write(:file_name, "the_desired_filename.png") photo.save