MailingList


Re: Problems with setup Globalize and Postgresql database

by timpeat :: Rate this Message:

Reply to Author | View in Thread


On 4 Mar 2008, at 22:25, Gunnar Wolf wrote:


(Yes, I know this is an old post - but it is still an open issue, this might
be useful for somebody...)

There are two ways to fix this - One is to patch Rails. I just sent a bug
report, and I'd expect it to be fixed as part of the next Rails release, as
it is quite straightforward:

http://dev.rubyonrails.org/ticket/11282

So, this would be the _proper_ way to fix it ;-) Now, you probably want a
workaround. Very easy: After generating your 'globalize' migration, edit the
generated file (say, db/migrate/009_globalize_migration.rb). Search for the
following block:

     reader.each do |row|
       next if row.first.nil? # skip blank lines
       raise "No table name defined" if !table_name
       raise "No header defined" if !column_clause
       values_clause = row.map {|v| cnx.quote(v).gsub('\\n',
"\n").gsub('\\r', "\r") }.join(', ')
       sql = "INSERT INTO #{table_name} (#{column_clause}) VALUES
(#{values_clause})"
       cnx.insert(sql)
     end
   end

Where it is? Depends on the type of migration you requested - for the 'tiny'
migration, it's at line 78. Replace cnx.insert(sql) with cnx.execute(sql) -
And that's it, the migration now works.
--
View this message in context: http://www.nabble.com/Problems-with-setup-Globalize-and-Postgresql-database-tp11507531s17045p15836316.html
Sent from the Globalize-rails.org mailing list archive at Nabble.com.



Tim Peat Web Design and Development

 www.timpeat.co.uk

 tel  +44 (0)133 531 00 00
 mob  +44 (0)771 533 94 88

 « Return to Thread: Problems with setup Globalize and Postgresql database