forked from havenweb/haven
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adjust sort order for feed entries so that new entries with older pub…
…lished dates don't get buried
- Loading branch information
Showing
4 changed files
with
47 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
db/migrate/20211013212351_add_sort_date_to_feed_entries.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class AddSortDateToFeedEntries < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :feed_entries, :sort_date, :datetime | ||
add_index :feed_entries, :sort_date | ||
|
||
reversible do |dir| | ||
dir.up do | ||
FeedEntry.find_each do |f| | ||
f.sort_date = f.published | ||
f.save! | ||
end | ||
end | ||
dir.down do | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters