Skip to content

Instantly share code, notes, and snippets.

@foxumon
Created March 3, 2017 20:55
Show Gist options
  • Select an option

  • Save foxumon/c032b68d8b9df90a6ffae945a4095b04 to your computer and use it in GitHub Desktop.

Select an option

Save foxumon/c032b68d8b9df90a6ffae945a4095b04 to your computer and use it in GitHub Desktop.

Revisions

  1. foxumon created this gist Mar 3, 2017.
    9 changes: 9 additions & 0 deletions check_string.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    a = MODEL.where("COLUMN like ?", "%SEARCH%");0

    puts a.length

    puts " "

    a.all.each do |a|
    puts a.id
    end;0
    8 changes: 8 additions & 0 deletions replace.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    ActiveRecord::Base.connection.execute(%q{
    update TABLE
    set COLUMN = replace(
    COLUMN,
    'BAD',
    'GOOD'
    )
    })