+ has_many :changesets, -> { order(:created_at => :desc) }
+ has_many :changeset_comments, :foreign_key => :author_id
+ has_and_belongs_to_many :changeset_subscriptions, :class_name => 'Changeset', :join_table => 'changesets_subscribers', :foreign_key => 'subscriber_id'
+ has_many :note_comments, :foreign_key => :author_id
+ has_many :notes, :through => :note_comments
+
+ has_many :client_applications
+ has_many :oauth_tokens, -> { order(:authorized_at => :desc).preload(:client_application) }, :class_name => "OauthToken"
+
+ has_many :blocks, :class_name => "UserBlock"
+ has_many :blocks_created, :class_name => "UserBlock", :foreign_key => :creator_id
+ has_many :blocks_revoked, :class_name => "UserBlock", :foreign_key => :revoker_id
+
+ has_many :roles, :class_name => "UserRole"
+
+ scope :visible, -> { where(:status => ["pending", "active", "confirmed"]) }
+ scope :active, -> { where(:status => ["active", "confirmed"]) }
+ scope :identifiable, -> { where(:data_public => true) }
+
+ has_attached_file :image,
+ :default_url => "/assets/:class/:attachment/:style.png",
+ :styles => { :large => "100x100>", :small => "50x50>" }