Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2233
  • Last Modified:

Rails uninitialized constant Iconv

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
terencepires
Asked:
terencepires
  • 3
  • 2
1 Solution
 
fridomCommented:
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
 
terencepiresAuthor Commented:
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
 
terencepiresAuthor Commented:
one more thing,
iconv.bundle was already installed in my version of Ruby.
0
 
fridomCommented:
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
 
terencepiresAuthor Commented:
thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now