Forum: Ruby on Rails Need Help with Globalize Plugin

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.
Donald N. (Guest)
on 2006-02-17 11:06
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/Frequent...

... 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
Donald N. (Guest)
on 2006-02-17 12:15
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.
Donald N. (Guest)
on 2006-02-20 13:32
can anyone help me with this one?
Joshua H. (Guest)
on 2006-02-20 14:57
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?
Donald N. (Guest)
on 2006-02-21 02:04
I'm also using ruby 1.8.2_4 if that also post a problem
This topic is locked and can not be replied to.