Class: AuthorsController

Inherits:
ContentController show all
Defined in:
app/controllers/authors_controller.rb

Instance Method Summary collapse

Methods included from BlogHelper

#blog_base_url, #this_blog

Instance Method Details

#showObject

Raises:

  • (ActiveRecord::RecordNotFound)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/authors_controller.rb', line 6

def show
  @author = User.find_by(login: params[:id])
  raise ActiveRecord::RecordNotFound unless @author

  @articles = @author.articles.published.page(params[:page])
    .per(this_blog.per_page(params[:format]))
  @page_title = this_blog.author_title_template.to_title(@author, this_blog, params)
  @keywords = this_blog.meta_keywords
  @description = this_blog.author_desc_template.to_title(@author, this_blog, params)

  auto_discovery_feed(only_path: false)

  respond_to do |format|
    format.rss { render_feed "rss" }
    format.atom { render_feed "atom" }
    format.html
  end
end