Sha256: 23176e4ffe775f083aa3189282b1afdb972faf3494970a41cba284352b4e5458
Contents?: true
Size: 692 Bytes
Versions: 2
Compression:
Stored size: 692 Bytes
Contents
module Crowdblog class User < ActiveRecord::Base self.table_name = :users include Gravtastic has_many :authored_posts, inverse_of: :author, foreign_key: 'author_id', class_name: 'Post' has_one :last_post, class_name: 'Post', foreign_key: :author_id, conditions: ['state = ?', 'published'], order: 'published_at DESC, created_at DESC, id DESC' devise :database_authenticatable, :token_authenticatable gravtastic :gravatar_email # INSTANCE METHODS def gravatar_email gravatar_alias || email end def last_post_at last_post.try(:published_at) end def publisher! update_attribute(:is_publisher, true) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crowdblog-0.0.3 | app/models/crowdblog/user.rb |
crowdblog-0.0.2 | app/models/crowdblog/user.rb |