Is there anyway validates_attachment_size, in addition to limiting the size of a dynamic file? Here is an example:
class Document < ActiveRecord::Base
belongs_to :folder
has_attached_file :document
validates_attachment_size :document, :less_than => get_current_file_size_limit
private
def get_current_file_size_limit
10.megabytes
end
end
I tried this, but I keep getting the "Unknown Method" error message. Lambdas and Procs do not work either. Has anyone ever tried this? Thanks
source
share