Need Help with Globalize Plugin


#1

Hi everyone,

I’ve been playing around with the Globalize plugin for some days now
but I can’t seem to make it work properly with my models. I’m currently
using Postgres 8.0 for the database and needed to make some
modifications with my migration file that was posted by Jake Morrison in
the Globalize wiki…

http://www.globalize-rails.org/wiki/pages/Frequently+Asked+Questions

… so that I can successfully create the DB schema.

Now I tried to follow the examples in the wiki when using models but
it seems that my data is not being stored in the globalize_translations
table. Anyway here is a sample of my code.

environment.rb:

include Globalize

controllers/application.rb:

class ApplicationController < ActionController::Base
Locale.set_base_language(‘en-US’)
end

models/sample.rb

class Trial < ActiveRecord::Base
translates :name
end

sample_controller.rb

class TrialController < ApplicationController
def index
Locale.set(‘en-US’)
Trial.create(:name => ‘One’)
Locale.set(‘es-ES’)
trial = Trial.find(1)
trial.name = ‘Uno’
if trial.save
render_text("#{trial.name")
end
end
end

When running the app I get this error:

RuntimeError: ERROR C42601 Msyntax error at or near “WHERE” P20
Fscan.l L639 Ryyerror: UPDATE trials SET WHERE id = 1

Looking at it closely, it seems that on the intiall save on the
database, no data is being saved on the globalize_translation table so
when I try to update the data from my trials table no value is being
passed.

I know that I have configured the app properly because data is being
passed to the globalized_translation folder when I do “foo”.t but I
really can’t make it work with my models.

Do you guys know how to fix this? I would really appreciate if you can
help me fix this problem.

Thanks a lot,
Dons


#2

BTW I’m using Mac OSX 10.4.4 with RoR 1.0 an Postgres 8.0 installed via
Darwinports if incase you need that info.


#3

can anyone help me with this one?


#4

Donald,

Try posting your problem to the Globalize mailing list:
http://globalize-rails.org/wiki/pages/MailingList

Josh

Donald Nakar wrote:

can anyone help me with this one?


#5

I’m also using ruby 1.8.2_4 if that also post a problem