iconv will be deprecated in the future, use String#encode instead - ruby-on-rails

Am getting the following deprecated warnings with ruby 1.9.3-p125 when i run rspec. But there are no deprecated warnings with ruby 1.9.2.
/gems/ruby-1.9.3-p125#cs/gems/soap4r-1.5.8/lib/xsd/iconvchars
et.rb:9:in `<top (required)>': iconv will be deprecated in the future, use String#encode instead.
/home/ec2-user/.rvm/gems/ruby-1.9.3-p125#cs/gems/hpricot-0.8.2/lib/hpricot/build
er.rb:2:in `require': /gems/ruby-1.9.3-p125#cs/gems/hpricot-0
.8.2/lib/fast_xs.so: undefined symbol: ruby_digitmap - /gems/
ruby-1.9.3-p125#cs/gems/hpricot-0.8.2/lib/fast_xs.so (LoadError)
What could be the cause here? Can someone please help with this.

There is a proposal for ruby 1.9.3 to move stdlibs to gems. As part of this transition transcoding between different string-encodings will be "gemified", see the Wiki (section: What stdlibs should be gemified?).
Therefore every time iconv is called, the deprecation-notice will be shown, in order to notify devs that future versions of ruby won't use lib/iconv and tell them that (and where) a code modification is necessary to account for these planned changes.
For now this is not problematic, as both iconv and String#encode will be supported in order to give devs time to make the transition. but you should keep in mind, that your code will break in future versions if you don't switch out the deprecated code.
A quick Google search will help you make the transition, e.g. "From Iconv#iconv to String#encode", if necessary. if you don't plan to make that change you should stay away from future versions and be extra careful when updating your env.

The log entry tells you that the problem is generated in the soap4r gem.
It looks like the gem was not updated for a while, version 1.5.8 is from year 2007
So it may also have other problems with ruby 1.9.3.
There is a project that claims to have a ruby-1.9 compatible version:
soap4r-ruby1.9
There are also other soap libraries for ruby, here you see some of them:
ruby-toolbox search for soap

Your problem is actually with hpricot, which apparently isn't compatible with ruby 1.9.3, and is throwing the "undefined symbol: ruby_digitmap" you are seeing here. Here's someone else with the same problem.
Unfortunately, hpricot is no longer maintained, so unless someone picks up the mantle, there probably won't be a fix. Your main options would appear to be to stick with ruby 1.9.2, or find an alternative to hpricot. Most people seem to be using nokogiri for XML and HTML parsing in ruby, but there are certainly other options.

To remove this warning...
go to your .rvm directory and find iconv.c (mine was at ~/.rvm/src/ruby-1.9.3-p125/ext/iconv/iconv.c)
edit that file are remove or comment out the call to warn_deprecated() (should be near the bottom)
from that file's directory, run ruby extconf.rb then make then make install
Should do the trick

Related

ActiveRecord::Relation's substitute_values was removed in Rails 5.2.0

I recently upgraded Rails to 5.2.0 and just noticed that substitute_values was removed from ActiveRecord::Relation
The thing is, I can't find any documentation about it, nor where it went or why it was removed. I don't think there was a deprecation warning, at least I couldn't find it. I did a search in the Rails Github and in SO, but couldn't find anything related with it
Does anyone know why it was removed or where can I read about it? I could just use the source code from 5.1.7, but I'd like to know where it was moved (if it was) so I can use it, or if it was removed for some specific reason

Configure Komodo Edit to use correct Ruby version via RVM

I want to use Komodo Edit 8 as my editor for my Ruby-on-Rails projects and I also use different versions of Ruby and Rails managed by RVM. I want Komodo Edit to automatically use the correct versions for its code-intelligence and syntax checking.
So does anyone have experience using RVM together with Komodo Edit 8? I don't think giving Komodo a absolute path to a Ruby version works in this scenario?
Any help would be appreciated, since I've spend almost 2 hours googling about this issue but didn't find a acceptable answer.
I think you can point to ~/.rvm/bin/rvm-auto-ruby. From the RVM site's page about TextMate integration:
The rvm-auto-ruby approach
Out of the box, rvm ships with a ruby binary, typically in ~/.rvm/bin (or, in system wide installs, inside of /usr/local/bin), that will perform the following steps before executing ruby:
Load up RVM
Look for any RVMRC files and load them
Execute as a normal ruby
This approach makes it possible to have the ruby switched on a per-project basis without any extra work. With rvm installed, this is a matter of taking the full path to rvm-auto-ruby, found via:
which rvm-auto-ruby
Take the time to go over RVM's site and become familiar with what information is there. That site is the best and most accurate information for using RVM. On the installation page, they say this about external tutorials for installing RVM, which applies to pretty much anything you want to know about RVM:
Note that that any outside tutorials are NOT supported whether they work or not. Tutorials are great, however we have spent massive amounts of man hours debugging the installation process. Please use the install process(es) from this site only, as this is the only supported installation types and methods.
In other words, even if you found information via an internet search, what you found could very possibly be wrong so go to RVM's site and see what you find. If nothing shows up, contact the authors as they are the best source of truth.
I want to use Komodo Edit 8 as my editor for my Ruby-on-Rails projects and I also use different versions of Ruby and Rails managed by RVM. I want Komodo Edit to automatically use the correct versions for its code-intelligence and syntax checking.
Look at RVM's "Typical RVM Project Workflow" page for information on how RVM can autoswitch your Ruby version and gem sets. It's not really for Komodo to do, it's RVM that handles that heavy-lifting.

Automatic identification of Ruby Gems no longer in use within Rails

Is it possible to automatically identify Ruby gems that are no longer in use within a Rails project?
For example if a fellow developer added gem 'nokogiri' to the Gemfile, for a piece of functionally, but the code that depended on that gem has now been removed. I am looking to port my entire project to jRuby so removing the gems that we no longer seems a very sensible starting point.
Thanks
Usually gems are used in a specific way, so for each one you will have to look for patterns manually.
For example, if I had to figure if Nokogiri is being used, I'd use git grep to find Nokogiri occurrences (I assume you use git):
git grep Nokogiri
If nothing is returned, you are probably not using it.
Another way is, if you have a test suite, is just to remove it and see if something breaks. Not foolproof, but if you have good tests it should be a pretty safe path.
On rubyforge there is a gem called gem_unused. It adds an 'unused' command to 'gem'. However, I am not able to test this as it seems to be failing on my system. (I'm new to the rails world so maybe this is an issue someone else could troubleshoot. I filed an issue on it on the maintainer's github)

Install and start programming Ruby on Rails on Mac?

I would like to try ruby on rails on mac. I want to install ruby on rails, tried to find some guide for installation, and I get this:
ruby on rails official website??
It does not have a clear, I mean, well documentation for beginner to follow the steps? Or, thats all for the installation? How to start the webserver, where to store ruby files etc, ... how do I get started???
Any advise, or links or tutorials for a total ruby beginner to get started?
This is their official guide:
http://guides.rubyonrails.org/getting_started.html
You need to install xcode first though to avoid some errors. This is because some of the headers in the default ruby install on macs is incomplete without it.
Well you need GCC, which used to be with XCode only but over at ye olde GitHub, it's been packaged as a standalone. Next up you can follow either this tutorial by Katz or Dan Benjamin's guide on HiveLogic.
Keep in mind the state of the art in Ruby and Rails is fast moving so the guides might not take you all the way there. The most crucial parts are getting RVM installed properly and working and getting everything on the right version. It's not too tricky to work through, and there's probably no undocumented issues in the process now.

Tracking down and fixing i18n deprecation warnings in rails 3 (cucumber 0.9.3 to blame?)

My cucumber test passes, but leaves this ridiculous stack trace. Just your basic The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead. error message, but how am I to find the culprit in that list?
I never used the {{key}} syntax myself, so some gem I'm using is outdated. Please tell me which one. It's really frustrating to have so much kruft every time I run a test.
I was getting that error with Authlogic and it turned out that the more recent versions of the I18n gem (0.4.x, I think) deprecated the call.
I avoided the problem by "rolling back" my I18n gem to version 0.3.7.
As to which plugin, at a guess this is the key line (line 15 on your gist):
/Library/Ruby/Gems/1.8/gems/responders-0.6.0/lib/responders/flash_responder.rb:115:in `set_flash_message!
Since it is the first one that is after the I18n lines, I suspect it is the one that is calling translate with the deprecated interpolation.
(Update a few minutes later):
Looking at: http://github.com/plataformatec/responders/commits/master, ...it looks like you could just upgrade to responders 0.6.2. Their commit on June 24th seems to address the issue.

Resources