Class: ArticlesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ArticlesController
- Defined in:
- app/controllers/articles_controller.rb
Instance Method Summary collapse
-
#category ⇒ Object
get /articles/:category_slug.
-
#index ⇒ Object
get /articles.
-
#show ⇒ Object
get /articles/:post_id-:post_slug.
-
#tagged ⇒ Object
get /articles/tagged/:tag_name.
Instance Method Details
#category ⇒ Object
get /articles/:category_slug
16 17 18 19 20 21 22 |
# File 'app/controllers/articles_controller.rb', line 16 def category @collection = Post.in_category_branch(@category).page_for_visitors(current_page) respond_to do |format| format.html format.json { render('posts/index') } end end |
#index ⇒ Object
get /articles
6 7 8 9 10 11 12 13 |
# File 'app/controllers/articles_controller.rb', line 6 def index post_type = PostType.find_by(slug: 'article') @collection = post_type.posts.for_language(current_language).page_for_visitors(current_page) respond_to do |format| format.html format.json { render('posts/index') } end end |
#show ⇒ Object
get /articles/:post_id-:post_slug
25 26 27 28 29 |
# File 'app/controllers/articles_controller.rb', line 25 def show @entity.increment :view_count @entity.increment :rating, 0.0025 @entity.save end |
#tagged ⇒ Object
get /articles/tagged/:tag_name
32 33 34 35 |
# File 'app/controllers/articles_controller.rb', line 32 def tagged post_type = PostType.find_by(slug: 'article') @collection = post_type.posts.tagged(params[:tag_name]).page_for_visitors(current_page) end |