Sha256: ceed420915e71b8d53e57da84b65437e16691af2d0ea6e30d6fa97b5d63f26ee
Contents?: true
Size: 630 Bytes
Versions: 2
Compression:
Stored size: 630 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crowdblog-0.0.5 | app/models/crowdblog/user.rb |
crowdblog-0.0.4 | app/models/crowdblog/user.rb |