# Undefined method \`force\_encoding' for "schema\_migrations":String

**URL:** <https://www.ruby-forum.com/t/undefined-method-force-encoding-for-schema-migrations-string/195609>\
**Category:** Rails\
**Created:** [September 26, 2010, 8:33pm UTC](https://www.ruby-forum.com/t/undefined-method-force-encoding-for-schema-migrations-string/195609 "2010-09-26T20:33:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 26, 2010, 8:33pm UTC](https://www.ruby-forum.com/t/undefined-method-force-encoding-for-schema-migrations-string/195609/1 "2010-09-26T20:33:26Z")

</div>

Hi people!

I need some help with some scary problem. I using rails 2.3.8 and  
can’t run my migrations. Strange thing is all works locally, but fail  
on server. I think I’ve missed some configuration, but can’t find  
which.

# rails 2.3.8, ruby 1.8.7, mysql 2.8.1

rake db:migrate RAILS\_ENV=“production” --trace  
(in /home/th48283/aj)  
\*\* Invoke db:migrate (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:migrate  
rake aborted!  
undefined method `force_encoding' for "schema_migrations":String /home/th48283/aj/config/initializers/fix_mysql_utf8.rb:5:in`encode’  
/home/th48283/aj/config/initializers/fix\_mysql\_utf8.rb:10:in `each' /home/th48283/aj/config/initializers/fix_mysql_utf8.rb:10:in`map’  
/home/th48283/aj/config/initializers/fix\_mysql\_utf8.rb:10:in `each' /home/th48283/aj/config/initializers/fix_mysql_utf8.rb:9:in`each\_orig’  
/home/th48283/aj/config/initializers/fix\_mysql\_utf8.rb:9:in `each' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/ activerecord-2.3.8/lib/active_record/connection_adapters/ mysql_adapter.rb:440:in`tables’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/  
activerecord-2.3.8/lib/active\_record/connection\_adapters/abstract/  
schema\_statements.rb:368:in `initialize_schema_migrations_table' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/ activerecord-2.3.8/lib/active_record/migration.rb:441:in`initialize’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/  
activerecord-2.3.8/lib/active\_record/migration.rb:401:in `new' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/ activerecord-2.3.8/lib/active_record/migration.rb:401:in`up’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/  
activerecord-2.3.8/lib/active\_record/migration.rb:383:in `migrate' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.8/ lib/tasks/databases.rake:112 /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:636:in`call’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake.rb:636:in `execute' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:631:in`each’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake.rb:631:in `execute' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:597:in`invoke\_with\_call\_chain’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/1.8/monitor.rb:242:in  
`synchronize' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:590:in`invoke\_with\_call\_chain’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake.rb:583:in `invoke' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:2051:in`invoke\_task’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake.rb:2029:in `top_level' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:2029:in`each’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake.rb:2029:in `top_level' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:2068:in`standard\_exception\_handling’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake.rb:2023:in `top_level' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:2001:in`run’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/  
lib/rake.rb:2068:in `standard_exception_handling' /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/ lib/rake.rb:1998:in`run’  
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rake-0.8.7/  
bin/rake:31  
/usr/bin/rake:19:in `load’  
/usr/bin/rake:19

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 27, 2010, 12:39am UTC](https://www.ruby-forum.com/t/undefined-method-force-encoding-for-schema-migrations-string/195609/2 "2010-09-27T00:39:49Z")

</div>

On Sep 26, 5:42 pm, Eduardo R [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> /home/th48283/aj/config/initializers/fix\_mysql\_utf8.rb:10:in `each' /home/th48283/aj/config/initializers/fix_mysql_utf8.rb:10:in `map’  
> /home/th48283/aj/config/initializers/fix\_mysql\_utf8.rb:10:in `each’  
> /home/th48283/aj/config/initializers/fix\_mysql\_utf8.rb:9:in

That initializer is calling a method that only exists in ruby 1.9

Fred
