Deprecation warning in rails 2.3.11 - ruby-on-rails

I am using Rails 2.3.11. I am getting a lot of deprecation warning like
DEPRECATION WARNING: Rake tasks in vendor/plugins/delayed_job/tasks,
vendor/plugins/fckeditor/tasks,
vendor/plugins/jrails/tasks,
vendor/plugins/query_reviewer/tasks,
vendor/plugins/thinking-sphinx/tasks,
vendor/plugins/tiny_mce/tasks, vendor/plugins/tolk/tasks,
and vendor/plugins/xss_terminate/tasks are deprecated.
Use lib/tasks instead. (called from /usr/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/tasks/rails.rb:10)
Give suggestions to avoid these warnings

Move tasks into lib/tasks…
No, actually, start using bundler. If an upgrade to Rails 3.x is too much work, at least move over to bundler and move all those dependencies into your Gemfile. It works fine with Rails 2.3.

Related

warning: constant ::Fixnum is deprecated When generating new model

I've tried to find some solution for this, but I really couldn't find anything related with the errors that is appearing to me when I run the rails command:
rails generate model Book title:string summary:text isbn:string
/home/vmu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/home/vmu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
/home/vmu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/core_ext/numeric/conversions.rb:138: warning: constant ::Fixnum is deprecated
Running via Spring preloader in process 3579
Expected string default value for '--jbuilder'; got true (boolean)
invoke active_record
identical db/migrate/20170104114702_create_books.rb
identical app/models/book.rb
invoke test_unit
identical test/models/book_test.rb
identical test/fixtures/books.yml
Anyone know what may be causing these errors?
This warnings appear because you are using ruby 2.4.0.
This version introduced this change: Unify Fixnum and Bignum into Integer
See here for the announcement: https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/
The warnings come from the activesupport gem which is part of rails and will be fixed in an upcoming release.
For now you can just ignore those warnings.
Update: Rails 5.0.2 has been released, which gets rid of the warnings.
I fixed mine by updating rails
bundle update rails
I assume you're using Rails 5? Check out this link (towards the bottom). Looks like these warnings will go away with release #27458.
If these deprecation warnings in active support are the only warnings you are seeing, you can surpress them by passing a RUBYOPT bash variable with the -W0 option which will silence.
so instead of rails server
try: RUBYOPT="-W0" rails server or RUBYOPT="-W0" bin/rails server
In rails 5.0 you may want to get in the habit of using bin/rails not just rails, since that's the global rails version which may or may not be the same as your local rails version.
I fixed this updating therubyracer gem from version '0.12.2' to '0.12.3'

How to fix warning in Rails

I'm newbie in Rails. I did something and this warning appear:
warning: parser/current is loading parser/ruby22, which recognizes
warning: 2.2.3-compliant syntax, but you are running 2.2.1.
warning:please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Can anyone help me explain why it appear and how to fix it?
Thanks a lot!
I got this error because I had the rubocop gem in my project which requires parser. I fixed it by locking my parser gem to the current ruby version we use.
For us, we use ruby 2.2.2, so I added gem 'parser', '~> 2.2.2.5' to my test group.
Since rubocop 0.24, he has used parser v2.2.x which means we we need to use ruby >= 2.2.2 to avoid that warning. Though the gem only requires ruby 1.9.3, so you can still use it but you're going to get warnings.
I was seeing this not only for rubocop but also for rspec and so. Fixed it by updating the parser gem with bundler. Didn't really specify a gem version. Just the latest one.
If you're using RuboCop, you may want to add require: false after the gem 'rubocop' statement in your Gemfile, so that you only load RuboCop when you use it.
Upgrading ruby to the newest version worked for me.
In my specific case I had
warning: parser/current is loading parser/ruby30, which recognizes warning: 3.0.1-compliant syntax, but you are running 3.0.0. warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
and had to upgrade ruby from 3.0.0 to 3.0.1

i am using rails 2.3.10 and i am using mysql database i try to create database for that time i am getting this error

DEPRECATION WARNING: Rake tasks in vendor/plugins/restful-authentication/tasks are deprecated. Use lib/tasks instead. (called from /home/laxmimayee/.rvm/gems/ruby-1.8.7-p374#catechumen/gems/rails-2.3.10/lib/tasks/rails.rb:10)
You need to add correct version of gem rake. I would suggest not to use rails 2. Support for rails 2 has been deprecated now. Try latest version of rails

Cannot create new Rails app

I let a friend use my computer for a bit and I don't know what he did exactly, I know he played around with different versions of Ruby and Rails to view various apps. Now I can't even create a new app anymore; I get the following error
$ rails new jhg
(in /Users/Naoki/.rvm/gems/ruby-2.1.2/gems/rails-0.9.5)
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
I'm brand new to rails and I can't find a solution to this problem, any help would be appreciated!!
It looks like you have multiple versions of Rails installed. Run gem uninstall rails and remove all the older versions.

rake aborted! ERROR: 'rake/rdoctask' is obsolete and no longer supported

I installed rails 3.2.3 in my pc but for my new project i need to work in rails 3.0.5 so I installed 3.0.5 version of rails and now when i write any rake command i get the following error
rake aborted! ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
currently this rake version is installed in my pc rake (10.1.0)
I know the error says everything but im new in ruby and rails. So i don't understand what to do. I googled it but most of the solutions ask to update rails
I know the error says everything but im new in ruby and rails. So i don't understand what to do. I googled it but most of the solutions ask to update rails
That's unfortunately the best solution. You are using a very old version of Rails that was based on some conventions of the time. Rake has changed and 10.0 is no longer compatible with that Rails version.
You should install a previous rake version. 0.9.0 should be sufficient.
In your Gemfile set
gem 'rake', '0.9.0'
then run $ bundle. Make sure you will prefix every command with
bundle exec
such as
bundle exec rake -T
instead of
rake -T
otherwise the script will fall back again using the most recent version of Rails on your machine.
For your reference, the reason of the error is probably caused by the documentation.rake file that at the very beginning it includes a deprecated rake file, removed in GH-1301.
Keep in mind that, assuming the app will then run, your first goal should be to upgrade your app. In fact, if you try to use it as it is, it's likely you will encounter so many other incompatibilities.
That was fairly simple to debug (assuming you have a reasonable knowledge of Ruby and Rails internals), but others may be harder or even impossible to fix forcing you to nothing else than upgrade.

Resources