Sha256: 22d8841c3385f4122a072f22d0aa99400b165b79c43d4bc33d90bd699f7bba15
Contents?: true
Size: 687 Bytes
Versions: 10
Compression:
Stored size: 687 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' 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 def to_param [email.split('@').first] end end end
Version data entries
10 entries across 10 versions & 1 rubygems