1

I´m using rails 3.0.7 with the globalize3 gem.

I have the model "Country" with traslated field "title".

In the rails console, try to find the record by its translated title like this:

gr = Country.find_by_title 'Greece'

This returns the correct record. But it is set to readonly, so I cannot save it.

Is this expected behaviour? What is causing it? I suspect it has something to to with some join generated by globalize3, but this is just an educated guess.

Is there a way around it, except just use the id to find the record?

Majiy
  • 1,890
  • 2
  • 24
  • 32
  • 1
    Can you also paste the query generated for the find? – Dhruva Sagar Feb 29 '12 at 09:52
  • There are the queries: `SELECT DISTINCT locale FROM country_translations` `SELECT countries.* FROM countries INNER JOIN country_translations ON country_translations.country_id = countries.id WHERE country_translations.locale IN ('de', 'en') AND ((country_translations.title = 'Greece' AND country_translations.locale IN ('en'))) LIMIT 1` `SELECT country_translations.* FROM country_translations WHERE (country_translations.country_id = 4)` – Majiy Mar 05 '12 at 11:25

0 Answers0