Class: NewsController

Inherits:
PostsController show all
Defined in:
app/controllers/news_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
# File 'app/controllers/news_controller.rb', line 4

def index
  @news = News.published.order('date DESC').paginate(page: params[:page],per_page: 10)
end

#showObject



8
9
10
11
# File 'app/controllers/news_controller.rb', line 8

def show
  @news = News.find(params[:id])
  @other_news = News.published.where("id != ?", @news.id).order('date DESC').limit(3)
end