Skip to content

Instantly share code, notes, and snippets.

@th1agoalmeida
Created October 9, 2010 05:02
Show Gist options
  • Save th1agoalmeida/617903 to your computer and use it in GitHub Desktop.
Save th1agoalmeida/617903 to your computer and use it in GitHub Desktop.
# encoding: utf-8
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:lockable
attr_accessible :full_name, :gender, :gender_policy, :birth, :birth_policy,
:time_zone, :background, :background_repeat_policy, :flavour, :description,
:website, :locale, :local
validates_length_of :username, :in => 6..20
has_attached_file :background, MyConfig.paperclip_options
#validates_attachment_content_type :background, :content_type => ['image/jpeg', 'image/gif', 'image/png']
#validates_attachment_size :background, :less_than => 1.megabytes
any paperclip validators will keep me from saving the model if :background is nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment