Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comment status change migration #2974

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions db/migrate/20180703164027_change_status_of_comments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class ChangeStatusOfComments < ActiveRecord::Migration[5.1]
def up
Comment.all.each do |comment|
comment.status = 1
comment.save({})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the {} required? Were you able to test this out locally?

In general it looks good to me!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, migration worked locally.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gauravano i'm curious, what's the purpose of this comment.status = 1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @siaw23, actually to make spam moderation system for comments, comments would come with 2 status values status = 1 for valid and status = 0 for spam.

end
end

def down
end
end
Loading