Solved

Rails uninitialized constant Iconv

Posted on 2009-05-03
5
2,154 Views
Last Modified: 2013-11-13
Hi there,

I'm having an issue with a RoR website : when trying to save a text change into the database i get the error below

Strange thing is that i imported the database from production where it is working well, under mysql on both development and production...

After being gone through some reasearch, i found this is most likely because of an encoding mismatch. But the encoding in the database.yml is the same in production and dev as well...

Any ideas ?
NameError in Admin/artistsController#update
 
uninitialized constant Iconv
 
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
 
vendor/rails/activesupport/lib/active_support/dependencies.rb:123:in `const_missing'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:78:in `urlnameify'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:85:in `attr_to_urlname'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:124:in `validate_urlname_against_class'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:117:in `validate_urlname'
vendor/rails/activerecord/lib/active_record/validations.rb:790:in `send'
vendor/rails/activerecord/lib/active_record/validations.rb:790:in `run_validations'
vendor/rails/activerecord/lib/active_record/validations.rb:788:in `each'
vendor/rails/activerecord/lib/active_record/validations.rb:788:in `run_validations'
vendor/rails/activerecord/lib/active_record/validations.rb:752:in `valid_without_callbacks'
vendor/rails/activerecord/lib/active_record/callbacks.rb:306:in `valid?'
vendor/rails/activerecord/lib/active_record/validations.rb:723:in `save_without_transactions'
vendor/rails/activerecord/lib/active_record/transactions.rb:126:in `save'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:91:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:118:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:126:in `save'
vendor/rails/activerecord/lib/active_record/base.rb:1439:in `update_attributes'
#{RAILS_ROOT}/app/controllers/admin/artists_controller.rb:45:in `update'
 
vendor/rails/activesupport/lib/active_support/dependencies.rb:123:in `const_missing'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:78:in `urlnameify'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:85:in `attr_to_urlname'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:124:in `validate_urlname_against_class'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:117:in `validate_urlname'
vendor/rails/activerecord/lib/active_record/validations.rb:790:in `send'
vendor/rails/activerecord/lib/active_record/validations.rb:790:in `run_validations'
vendor/rails/activerecord/lib/active_record/validations.rb:788:in `each'
vendor/rails/activerecord/lib/active_record/validations.rb:788:in `run_validations'
vendor/rails/activerecord/lib/active_record/validations.rb:752:in `valid_without_callbacks'
vendor/rails/activerecord/lib/active_record/callbacks.rb:306:in `valid?'
vendor/rails/activerecord/lib/active_record/validations.rb:723:in `save_without_transactions'
vendor/rails/activerecord/lib/active_record/transactions.rb:126:in `save'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:91:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:118:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:126:in `save'
vendor/rails/activerecord/lib/active_record/base.rb:1439:in `update_attributes'
vendor/rails/actionpack/lib/action_controller/base.rb:910:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:910:in `perform_action_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:381:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:381:in `process_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:377:in `process_without_session_management_support'
vendor/rails/actionpack/lib/action_controller/session_management.rb:117:in `process'
vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch'
vendor/rails/railties/lib/webrick_server.rb:115:in `handle_dispatch'
vendor/rails/railties/lib/webrick_server.rb:81:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
vendor/rails/railties/lib/webrick_server.rb:67:in `dispatch'
vendor/rails/railties/lib/commands/servers/webrick.rb:59
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in `require'
vendor/rails/railties/lib/commands/server.rb:30
script/server:3:in `require'
script/server:3
 
vendor/rails/activesupport/lib/active_support/dependencies.rb:123:in `const_missing'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:78:in `urlnameify'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:85:in `attr_to_urlname'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:124:in `validate_urlname_against_class'
vendor/plugins/acts_as_urlnameable/lib/acts_as_urlnameable.rb:117:in `validate_urlname'
vendor/rails/activerecord/lib/active_record/validations.rb:790:in `send'
vendor/rails/activerecord/lib/active_record/validations.rb:790:in `run_validations'
vendor/rails/activerecord/lib/active_record/validations.rb:788:in `each'
vendor/rails/activerecord/lib/active_record/validations.rb:788:in `run_validations'
vendor/rails/activerecord/lib/active_record/validations.rb:752:in `valid_without_callbacks'
vendor/rails/activerecord/lib/active_record/callbacks.rb:306:in `valid?'
vendor/rails/activerecord/lib/active_record/validations.rb:723:in `save_without_transactions'
vendor/rails/activerecord/lib/active_record/transactions.rb:126:in `save'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:91:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:118:in `transaction'
vendor/rails/activerecord/lib/active_record/transactions.rb:126:in `save'
vendor/rails/activerecord/lib/active_record/base.rb:1439:in `update_attributes'
#{RAILS_ROOT}/app/controllers/admin/artists_controller.rb:45:in `update'
vendor/rails/actionpack/lib/action_controller/base.rb:910:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:910:in `perform_action_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:381:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:381:in `process_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:377:in `process_without_session_management_support'
vendor/rails/actionpack/lib/action_controller/session_management.rb:117:in `process'
vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch'
vendor/rails/railties/lib/webrick_server.rb:115:in `handle_dispatch'
vendor/rails/railties/lib/webrick_server.rb:81:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
vendor/rails/railties/lib/webrick_server.rb:67:in `dispatch'
vendor/rails/railties/lib/commands/servers/webrick.rb:59
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in `require'
vendor/rails/railties/lib/commands/server.rb:30
script/server:3:in `require'
script/server:3
 
This error occured while loading the following files:
   active_record/acts/urlnameable/instance_methods/iconv.rb
 
Request
 
Parameters: {"artist"=>{"name"=>"Alexandra Maria Lara", "name_ja"=>"Alexandra Maria Lara", "name_fr"=>"Alexandra Maria Lara", "splash_image_temp"=>"", "bio_ja"=>"", "bio_fr"=>"V&eacute;ritable star en Allemagne, son pays d'adoption, cette jeune actrice d'origine roumaine a &eacute;t&eacute; rep&eacute;r&eacute;e dans <em>La Chute</em>, de Olivier Hirschbiegel ou encore dans <em>Control</em>, de Anton Corbijn.<br /> Apr&egrave;s un r&ocirc;le dans <em>L'homme sans &acirc;ge</em>, de Francis Ford Coppola, on la verra dans <em>The City of Your Final Destination</em>, de James Ivory. Elle vient &eacute;galement de tourner avec Spike Lee et Stephen Daldry (<em>Billy Elliot</em>).", "name_zh"=>"", "bio_zh"=>"", "splash_image"=>#<StringIO:0x1b6e4e0>, "bio"=>"", "artist_cat"=>"0"}, "commit"=>"Enregistrer", "id"=>"38"}
 
Show session dump
 
--- 
:authenticated: true
flash: !map:ActionController::Flash::FlashHash {}
 
 
Response
Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}

Open in new window

0
Comment
Question by:terencepires
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 24

Expert Comment

by:fridom
ID: 24293639
Obviously on your development machine the Iconv library is not installed.

On Debian you can change that with apt-get install libiconv-ruby
or apt-get install ruby1.8-dev. That seems to be the most reasonable approach
for getting a bit more running on your System.

You may try your luck with a Gem install on other systems or check the
site of your distribution on how to get libiconv for Ruby

Regards
Friedrich

0
 
LVL 1

Author Comment

by:terencepires
ID: 24302839
Hi friedrich,

first off, thanks for your help !

i tried to reinstall iconv following your lead but it had no effect on my error....
I then found a tutorial here, which i tried too (it's in french) :
 
http://t37.net/ruby-iconv-et-freebsd-sont-dans-un-bateau.html 

sadly, it had no effect as well...

And when browsing the internet i can't seem to find anything addressing my issue...
0
 
LVL 1

Author Comment

by:terencepires
ID: 24302847
one more thing,
iconv.bundle was already installed in my version of Ruby.
0
 
LVL 24

Accepted Solution

by:
fridom earned 500 total points
ID: 24303965
The mentioned URL assumes that the development  files for iconv are installed. That seems to be not the case on your system. So check where you can get the headers and libraries for compiling iconv. So in fact my comment above still hold the development files for Iconv are not there. I can't tell where to get prebuld libraries for Mac, but mac is an Unix and so compiling iconf should be very doable...

Regards
Friedrich
0
 
LVL 1

Author Closing Comment

by:terencepires
ID: 31577349
thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Free Ruby on Rails hosting 4 544
undefined method `+' for nil:NilClass (NoMethodError) on Ruby 3 1,081
Ruby issue 7 298
Upgrading Ruby & Rails on CentOS 3 446
I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below: http://www.rubytips.org/2008/05/13/accessing-windows-api-fro…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question