Skip to content

Instantly share code, notes, and snippets.

@hdeshev
Created January 10, 2012 14:33
Show Gist options
  • Save hdeshev/1589362 to your computer and use it in GitHub Desktop.
Save hdeshev/1589362 to your computer and use it in GitHub Desktop.
Filer - Validation
class User < ActiveRecord::Base
has_file :avatar, AvatarUploader
validates_file_extension_of :avatar, :allowed => ["jpg", "png"]
end
class User < ActiveRecord::Base
has_file :avatar, AvatarUploader
validates_file_size_of :avatar, :less_than => 1 * 1024 * 1024
end
class User < ActiveRecord::Base
has_file :avatar, AvatarUploader
validates_presence_of :avatar
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment