We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18fa06c commit 57c0d0fCopy full SHA for 57c0d0f
app/controllers/home_controller.rb
@@ -3,6 +3,6 @@ def show
3
@dojo_count = Dojo.active_dojos_count
4
@regions_and_dojos = Dojo.group_by_region_on_active
5
@prefectures_and_dojos = Dojo.group_by_prefecture_on_active
6
- @news_items = News.all.order(published_at: :desc).limit(7)
+ @news_items = News.recent.limit(7)
7
end
8
app/models/news.rb
@@ -1,2 +1,3 @@
1
class News < ApplicationRecord
2
+ scope :recent, -> { order(published_at: :desc) }
0 commit comments