Skip to content

Commit

Permalink
migration for attaching first-time-poster
Browse files Browse the repository at this point in the history
  • Loading branch information
cesswairimu committed Mar 1, 2019
1 parent 9c5fc65 commit 071e6bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
14 changes: 14 additions & 0 deletions db/migrate/20190301075323_add_first_tag_poster.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class AddFirstTagPoster < ActiveRecord::Migration[5.2]
def find_and_update
User.joins(:node).where('node.status = ?', 1).each do |user|
if user.nodes.present?
node = user.nodes.first
node.add_tag('first-time-post', user)
end
end
end

def up
find_and_update
end
end
30 changes: 0 additions & 30 deletions lib/tasks/first_timer_tag.rake

This file was deleted.

0 comments on commit 071e6bd

Please sign in to comment.