Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FixHogeTables < ActiveRecord::Migration[5.1]
- def change
- table(:hoges).where(type: 'bar').each do |hoge|
- ...
- end
- end
- def table(name)
- result = Class.new(ActiveRecord::Base) do
- self.table_name = name
- self.inheritance_column = :_dummy_column
- end
- result.reset_column_information
- result
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement