Class: SiteBlog::ArticlesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SiteBlog::ArticlesController
- Defined in:
- app/controllers/site_blog/articles_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /articles.
-
#main ⇒ Object
GET /articles/main.
-
#show ⇒ Object
GET /articles/:slug.
Instance Method Details
#index ⇒ Object
GET /articles
6 7 8 9 |
# File 'app/controllers/site_blog/articles_controller.rb', line 6 def index @data = Article.filters(params) render formats: :json end |
#main ⇒ Object
GET /articles/main
12 13 14 15 |
# File 'app/controllers/site_blog/articles_controller.rb', line 12 def main @article = Article.main render formats: :json end |
#show ⇒ Object
GET /articles/:slug
18 19 20 21 22 |
# File 'app/controllers/site_blog/articles_controller.rb', line 18 def show @article = Article.find_by(slug: params[:id]) @article.increment!(:view_count) render formats: :json end |