I'm pretty new to Rails. I keep seeing these deprecation warnings when I start my app:
DEPRECATION WARNING: ref is deprecated and will be removed from Rails 3.2.
(called from <top (required)> at D:/dev/AquaticKodiak/config/application.rb:12)
DEPRECATION WARNING: new is deprecated and will be removed from Rails 3.2.
(called from <top (required)> at D:/dev/AquaticKodiak/config/application.rb:12)
OK, what's on line 12? This:
Bundler.require(:default, :assets, Rails.env)
Hmm, that's not really narrowing it down. This says to me that one of the gems that's related to my app is using a keyword that will disappear soon. I'd really like to figure out which one. All the gems in my gemfile are using the >= [version] syntax, except the ones that are coming from github. I suspect that the github stuff is causing this, but how do I find out which project it is? Pulling code and searching for the keyword looks like work -- is there an easier way?
The Rails deprecation warning is pretty unhelpful here. It has a complete callstack that could help you find the out of date gem, but is filtering the result to return the first non-framework point in the callstack, in this case application.rb.
To find the offending gem I would grab the full callstack at ActiveSupport::Deprecation.warn, which is defined at line 10 of activesupport/lib/active_support/deprecation/reporting.rb.
If you have Pry installed (recommended) then add a conditional binding at line 11 of reporting.rb:
binding.pry if message =~ /ref is deprecated/
Then inspect caller.
If you post a Gemfile I can take a look for you.
Related
I'm trying to understand the deprecation warning:
DEPRECATION WARNING: Initialization autoloaded the constants
ActionText::ContentHelper and ActionText::TagHelper.
Being able to do this is deprecated. Autoloading during initialization is
going
to be an error condition in future versions of Rails.
Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload
ActionText::ContentHelper, for example,
the expected changes won't be reflected in that stale Module object.
These autoloaded constants have been unloaded.
In order to autoload safely at boot time, please wrap your code in a reloader
callback this way:
Rails.application.reloader.to_prepare do
# Autoload classes and modules needed at boot time here.
end
That block runs when the application boots, and every time there is a reload.
For historical reasons, it may run twice, so it has to be idempotent.
Check the "Autoloading and Reloading Constants" guide to learn more about how
Rails autoloads and reloads.
(called from <top (required)> at
/home/keith/development/pciapp/config/environment.rb:5)
What does this deprecation warning mean and how do I resolve it?
A bit of sleuthing revealed two sources of this deprecation warning in my Rails 6.1 app.
I referenced ActionMailer::Base in a couple of initializers. Based on the suggestion in the Rails Guides (https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration), I decided to move all those references to environment.rb.
The same deprecation error was also apparently being generated by the mailgun-ruby gem v 1.2.3. It appears the deprecation warning has been fixed in v 1.2.4.
it was an issue in rails 6.0.0 https://github.com/rails/rails/issues/36546 updating to rails 6.0.1 should fix this
Rails test is throwing a deprecation warning over a gem (attr_encrypted) which is already updated to the latest version. It reads:
DEPRECATION WARNING: <custom_attribute_name> is not an attribute known to Active Record. This behavior is deprecated and will be removed in
the next version of Rails. If you'd like <custom_attribute_name> to be managed by Active Record, add attribute :<custom_attribute_name> to your class.
Not sure what it is asking me to do... it must be declared using attr_encrypted.
The deprecation warning is something the attr_encrypted gem needs to fix, but it seems there is a workaround by adding the attribute call as mentioned in the warning.
See https://github.com/attr-encrypted/attr_encrypted/issues/260
I am upgrading an app to 4.0 and using ruby-2.2.5. I am down to a couple of Deprecation Warnings, which appear when I run >> bundle exec rake.
One of the warnings:
DEPRECATION WARNING: Model based mass assignment security has been extracted out of Rails into a gem.
Please use the new recommended protection model for params or add `protected_attributes` to your Gemfile to use the old one.
To disable this message remove the `whitelist_attributes` option from your `config/application.rb` file
and any `mass_assignment_sanitizer` options from your `config/environments/*.rb` files.
See http://guides.rubyonrails.org/security.html#mass-assignment for more information.
I understand what this about and I have gone through all my models looking for and removing 'attr_accessible'. I have gone through all my controllers and added a method for strong_params, which I call in my 'create' and 'update' actions. We are not using 'whitelist_attributes' or any 'mass_assignment_sanitizer' options. And, all my spec tests are passing.
My Questions is, Would this warning be just a standard output or would it be from rails seeing something I am not? Ideas?
Much appreciated
Try adding gem 'protected_attributes', '~>1.1.3' at your Gemfile, some people say that gem is unnecessary on Rails 4 but it fix the Deprecation, I not sure if is the best solution: https://github.com/rails/protected_attributes
I am using the Compass gem for Rails. After installing it, I've used some mixins that come with Compass. I am getting a deprecation warning in the console:
DEPRECATION WARNING on line 87 of /usr/local/rvm/gems/ruby-2.3.0/gems/compass-core-1.0.3/stylesheets/compass/css3/_deprecated-support.scss: #{} interpolation near operators will be simplified
in a future version of Sass. To preserve the current behavior, use quotes:
unquote('"$moz-"#{$experimental-support-for-mozilla} "$webkit-"#{$experimental-support-for-webkit} "$opera-"#{$experimental-support-for-opera} "$microsoft-"#{$experimental-support-for-microsoft} "$khtml-"#{$experimental-support-for-khtml}')
You can use the sass-convert command to automatically fix most cases.
I am having trouble finding a fix for this online. What does this warning mean and what can I do to fix it?
Apparently this is a bug in the gem. Workaround until fix is pushed to gem here: https://github.com/Compass/compass/pull/2088
in one of my applications I get the annoying deprecation warning of squeel all the time.
DEPRECATION WARNING: Core extensions are deprecated and will be removed in Squeel 2.0. (called from app/config/initializers/configurations/squeel_init.rb:13:in `block in <top (required)>')
It is produced by this line:
config.load_core_extensions :hash, :symbol
We are running * squeel (1.2.3).
Any ideas how to avoid this message?
Thanks!
I want to say that the reason why you are getting the WORKING is to let you know that if you upgrade your gem to squeel (2.0) the Core Extensions will not work.
I think if you upgrade your gem to squeel (2.0) you will have to remove that line.
I hope that you have test in place to see where you need to upgrade your app.
Deprecation is an attribute applied to a computer software feature,
characteristic, or practice to indicate that it should be avoided
(often because it is being superseded).