Forum: Ruby on Rails Error when *just* adding utf8 encoding to database.yaml

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A5aa88cb70b8afb8511b1e77dd57964f?d=identicon&s=25 Andy Churchstone (andy)
on 2006-05-24 21:41
Hi,

I have Ruby 1.8.4 and have my MyISAM db and tables created via the
migration files to utf8. A check with MySQL Front shows that all the
tables and the db have been correctly created as I wanted them.

I want the site to be in UTF8 format, and added the bit to
application_controller.rb to get the correct header. All still worked
fine at this stage. But I run into trouble when adding:

encoding: utf8

to my otherwise untouched database.yaml.

I had just committed a working version of the site to subversion before
editing database.yaml and after the database.yaml the the next command I
ran, ruby script/generate model job_client_type, came up with an error:

C:/ruby/lib/ruby/1.8/yaml:133:in 'load': syntax error on line 13, 10:
'adapter: mysql' (ArgumentError)
[Many other errors on initializer.rb, custom_require.rb etc - I can list
all if it helps]
Ends with [...]active_support/dependencies.rb:147: in 'require' from
script/generate: 3

Tried figuring out the problem for hours but can't.

Only a termination of Webrick, deletion of the site and re-export from
subversion with the original database.yaml fixes everything again (i.e.
the model command runs). Merely taking out the offending line from
database.yaml to effectively reverse the change does *not* do the trick
even though it should - fresh export only, which is weird.

Any ideas?
A5aa88cb70b8afb8511b1e77dd57964f?d=identicon&s=25 Andy Churchstone (andy)
on 2006-05-24 21:43
BTW, if it helps, I was following the instructions on
http://ruphus.com/blog/2005/06/23/getting-unicode-...
D90ef6808433e63203e15a5c2dadb0bb?d=identicon&s=25 Ben Reubenstein (Guest)
on 2006-05-24 21:51
(Received via mailing list)
Do you have some stray tabs in the file?

~ Ben
A5aa88cb70b8afb8511b1e77dd57964f?d=identicon&s=25 Andy Churchstone (andy)
on 2006-05-24 22:52
Ben Reubenstein wrote:
> Do you have some stray tabs in the file?
>
> ~ Ben

Ben,

Sorry about the delay - was in the middle of a model creation/testing
and wanted to finish and commit to subversion before attempting to
recreate the error.

As soon as you mentioned this, I was very positive you had cracked it as
ArachnoRuby is a bit too tab-happy...

I changed the file in Wordpad, and it seems this was fine. Tabs were the
culprit... or rather my stupidity for the oversight. A tab instead of
two spaces kills everything - script/generate, script/server etc.

Would be nice for it not to be so temperamental in a future release, but
thanks a million Ben.
This topic is locked and can not be replied to.