Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveRecord::Migrator.proper_table_name is deprecated

Does anyone know how to resolve this deprecation? I have included the deprecation warning and the offending migration file.

DEPRECATION WARNING: ActiveRecord::Migrator.proper_table_name is deprecated and will be removed in Rails 4.2. Use the proper_table_name instance method on ActiveRecord::Migration instead. (called from change at project/db/migrate/20141010204446_add_state_to_uploads.rb:4)

# db/migrate/20141010204446_add_state_to_uploads.rb
class AddStateToUploads < ActiveRecord::Migration
  def change
    add_column :uploads, :state, :string, index: true
    add_index :uploads, :state
  end
end

Cite:

  • https://github.com/rails/rails/pull/15512
  • http://apidock.com/rails/v4.0.2/ActiveRecord/Migrator/proper_table_name/class
like image 382
scarver2 Avatar asked Oct 29 '14 03:10

scarver2


1 Answers

Simply use ActiveRecord::Migration.proper_table_name instead when you upgrade to Rails 4.2. Apparently a resolution for the Warning message is not available in 4.0 or 4.1.

http://guides.rubyonrails.org/4_2_release_notes.html

like image 115
mrlindsey Avatar answered Oct 05 '22 09:10

mrlindsey