Class: SiteBlog::ArticlesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/site_blog/articles_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

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

#mainObject

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

#showObject

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