Skip to content

Instantly share code, notes, and snippets.

@codemilan
Created October 16, 2014 05:03
Show Gist options
  • Save codemilan/d712a50e370cd430cae3 to your computer and use it in GitHub Desktop.
Save codemilan/d712a50e370cd430cae3 to your computer and use it in GitHub Desktop.
File size validator- presence true not working
require 'file_size_validator'
class Song < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
validates :attachment, :presence => true,
:file_size => {:maximum => 2.megabytes.to_i}
end
when I submit form without file or empty form it gives error :
ActionController::ParameterMissing at /songs
param is missing or the value is empty: song
- since I'm new to rails does validates :presence => true not working or the problem is any thing else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment