问题
[pinterestclone]$ rake db:migrate
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block (2 levels) in <class:Railtie> at /usr/local/lib/ruby/gems/2.3.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:57)
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block (2 levels) in <class:Railtie> at /usr/local/lib/ruby/gems/2.3.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:58)
== 20160721232702 AddUserIdToPins: migrating ==================================
-- add_column(:pins, :user_id, :integer)
-> 0.0010s
-- add_index(:pins, :user_id)
-> 0.0010s
== 20160721232702 AddUserIdToPins: migrated (0.0022s) =========================
回答1:
This is caused by Sprockets 3.7.0 and should be fixed in sass-rails (which uses Sprockets) shortly. See this for more information.
I guess Sprockets 4 requires you to register a mime type before calling register_engine.
UPDATE: This is now fixed in sass-rails version 5.0.6. Running bundle update
should remove the deprecation warnings.
回答2:
To fix this open your project in terminal and write "bundle update sprockets"
来源:https://stackoverflow.com/questions/38515972/rails-4-rake-command-shows-deprecation-warning-everytime-i-run-the-rake-dbmig