I am trying to display the filename of a Carrierwave attachment in a Rails erb template. The following does not work:
<%= @page.form.filename %>
This is my solution:
before_save :update_file_attributes def update_file_attributes if file.present? && file_changed? self.content_type = file.file.content_type self.file_size = file.file.size self.file_name = read_attribute(:file) end end