Andy Churchstone
2006-May-24 19:42 UTC
[Rails] Error when *just* adding utf8 encoding to database.yaml
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? -- Posted via http://www.ruby-forum.com/.
Ben Reubenstein
2006-May-24 19:47 UTC
[Rails] Error when *just* adding utf8 encoding to database.yaml
Do you have some stray tabs in the file? ~ Ben On 5/24/06, Andy Churchstone <andrew_churchstone-1@yahoo.co.uk> wrote:> > 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? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ben Reubenstein 303-947-0446 http://www.benr75.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060524/f550349a/attachment.html
Andy Churchstone
2006-May-24 20:17 UTC
[Rails] Re: Error when *just* adding utf8 encoding to database.yaml
BTW, if it helps, I was following the instructions on http://ruphus.com/blog/2005/06/23/getting-unicode-mysql-and-rails-to-cooperate/ -- Posted via http://www.ruby-forum.com/.
Andy Churchstone
2006-May-24 20:52 UTC
[Rails] Re: Error when *just* adding utf8 encoding to database.yaml
Ben Reubenstein wrote:> Do you have some stray tabs in the file? > > ~ BenBen, 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. -- Posted via http://www.ruby-forum.com/.