Class: RailsBlogEngine::Post

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/rails_blog_engine/post.rb

Class Method Summary collapse

Class Method Details

.author_byline(author) ⇒ Object

Try to generate a reasonable byline for an author. We use a author.byline method if present, and default to author.email stripped of its domain.



61
62
63
64
65
66
67
68
69
70
# File 'app/models/rails_blog_engine/post.rb', line 61

def (author)
  case
  when author.respond_to?(:byline) && author.
    author.
  when author.respond_to?(:email) && author.email
    author.email.sub(/@.*\z/, '')
  else
    'unknown'
  end
end