Class: FixDangerousAttributes

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/tkh_search/create_or_update_migrations/templates/fix_dangerous_attributes.rb

Class Method Summary collapse

Class Method Details

.downObject



11
12
13
14
# File 'lib/generators/tkh_search/create_or_update_migrations/templates/fix_dangerous_attributes.rb', line 11

def self.down
  rename_column :tkh_search_instances, :host_model_name, :model_name
  rename_column :tkh_search_results, :host_model_name, :model_name
end

.upObject

ActiveRecord raises an exception if some model attributes use the same word as some AR methods or attributes.



6
7
8
9
# File 'lib/generators/tkh_search/create_or_update_migrations/templates/fix_dangerous_attributes.rb', line 6

def self.up
  rename_column :tkh_search_instances, :model_name, :host_model_name
  rename_column :tkh_search_results, :model_name, :host_model_name
end