Normalize all Weibo URLs in artist entries to one of these forms: * https://www.weibo.com/u/5399876326 * https://www.weibo.com/p/1005055399876326 * https://www.weibo.com/chengziyou666
14 lines
362 B
Ruby
Executable File
14 lines
362 B
Ruby
Executable File
require_relative "../../config/environment"
|
|
|
|
# Run a block of code in a transaction, and only commit it after confirmation.
|
|
def with_confirmation(&block)
|
|
ApplicationRecord.transaction do
|
|
CurrentUser.scoped(User.system, "127.0.0.1") do
|
|
yield
|
|
|
|
print "Commit? (yes/no): "
|
|
raise "abort" unless STDIN.readline.chomp == "yes"
|
|
end
|
|
end
|
|
end
|