Skip to content

Commit

Permalink
fix a bug and and add migration to populate counter cache
Browse files Browse the repository at this point in the history
  • Loading branch information
pessi-v committed Jul 7, 2024
1 parent 8fa792a commit 2ff8bde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def valid_feed
private

def add_description_and_image
uri = URI(s.url)
uri = URI(url)
uri.query = uri.fragment = nil
uri.path = ""
ogp = Ogpr.fetch(uri.to_s)
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20240707123333_populate_source_articles_count.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class PopulateSourceArticlesCount < ActiveRecord::Migration[7.1]
def up
Source.find_each do |source|
Source.reset_counters(source.id, :articles)
end
end
end

0 comments on commit 2ff8bde

Please sign in to comment.