Sorry about that. Was tired towards the end of the day and therefore a =
not so bright post. I owe it to the group to clear things up.
To make a long story short, it was the character encoding problem with =
ruby 1.9.2.
The following is a snippet of code from seeds.rb file
courses =3D [ {:title =3D> 'Principles of Good Cooking 1', :course_code =3D=
'PGC1',
:lessons =3D> [{:title =3D> 'Getting Started'},
{:title =3D> 'Saut=E2=88=9A=C2=A9ing',
:topics =3D> [ {:tag =3D> "Lecture", :title =3D> "Introduction to =
Saut=E2=88=9A=C2=A9ing",
ages =3D> [ {:title =3D> "Video Lecture" }] },
{:tag =3D> "Quiz", :title =3D> "Test Your Saut=E2=88=9A=C2=A9ing =
IQ",
ages =3D> [ {:title =3D> "Questions" }] },
{:tag =3D> "Taste Test", :title =3D> "Cooking With Wine",
ages =3D> [ {:title =3D> "Introduction"},
{:title =3D> "Instructions"},
{:title =3D> "Taste Wine"},
{:title =3D> "Reduce Wine"},
{:title =3D> "Taste Reduced Wine"},
{:title =3D> "Your Results" },
See that 'Saut=E2=88=9A=C2=A9ing', string?
That is Sauteing with funny symbols over e for french. That was causing =
the
rake db:seed command to fail (throw exception) as follows:
bruparel:~/school
=E2=86=92 rake db:seed
(in /Users/bruparel/school)
rake aborted!
/Users/bruparel/school/db/seeds.rb:3: invalid multibyte char (US-ASCII)
/Users/bruparel/school/db/seeds.rb:3: invalid multibyte char (US-ASCII)
/Users/bruparel/school/db/seeds.rb:3: syntax error, unexpected $end, =
expecting '}'
{:title =3D> 'Saut=C3=A9ing',
^
The solution was to put the following line at the top of this file =
(seeds.rb)
# encoding: utf-8
Now rake db:seed ran fine and indeed populated the tables. I could see =
the correct character encoding in the databases (both SQLite3 and =
Postgres) but the display was coming out with plain "Sauteing" instead =
of the French rendition of "e", that was because of the following line =
in database.yml file.
development:
adapter: sqlite3
pool: 5
timeout: 5000
encoding: utf8 <--- because of this
database: db/atk_school_development
Instead it should be as follows:
development:
adapter: sqlite3
pool: 5
timeout: 5000
encoding: unicode <--- this works
database: db/atk_school_development
If someone can articulate some simple rules for character encoding in =
Ruby 1.9.2 p0 and Rails 3.0.1 environment, that will be quite useful.
Thanks.
Bharat
-- =
Posted via
http://www.ruby-forum.com/.=