globalize3

Trouble upgrading Ruby on Rails from version 3.2.13 to 4.0.0

跟風遠走 提交于 2020-01-14 18:50:46
问题 For a my application I am trying to upgrade Ruby on Rails from version 3.2.13 to 4.0.0 and I am in trouble when installing / updating some gem (by using the Bundler), specifically the globalize3 gem. I am running Ruby 2.0.0-p247 . Given my Gemfile is: gem 'rails', '4.0.0' gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4' gem 'delayed_job', :git => 'git://github.com/collectiveidea/delayed_job.git', :branch => 'master' gem 'delayed_job_active_record', :git => 'git://github.com

Trouble upgrading Ruby on Rails from version 3.2.13 to 4.0.0

落爺英雄遲暮 提交于 2020-01-14 18:49:34
问题 For a my application I am trying to upgrade Ruby on Rails from version 3.2.13 to 4.0.0 and I am in trouble when installing / updating some gem (by using the Bundler), specifically the globalize3 gem. I am running Ruby 2.0.0-p247 . Given my Gemfile is: gem 'rails', '4.0.0' gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4' gem 'delayed_job', :git => 'git://github.com/collectiveidea/delayed_job.git', :branch => 'master' gem 'delayed_job_active_record', :git => 'git://github.com

Relation “translations” does not exist after migrating to Rails 3.2.1

断了今生、忘了曾经 提交于 2020-01-06 02:28:12
问题 I migrated from Rails 3.1.3 to 3.2.1 and got the following error when loading the home page: PGError: ERROR: relation "translations" does not exist LINE 4: WHERE a.attrelid = '"translations"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"translations"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum This happens when

Ruby on Rails with Globalize3: find by translated field makes record readonly

戏子无情 提交于 2020-01-03 03:07:32
问题 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

Globalize3 order records by translated attributes and taking fallbacks into consideration

随声附和 提交于 2019-12-23 12:35:34
问题 Im having troubles with awesome Globalize3 gem. For now I`m having two languages :en and :ru. And :ru falls back to :en like this #/config/initializers/globalize.rb Globalize.fallbacks = {:ru => [:ru, :en]} In my controller I am trying to sort the whole collection of translated records either by name translations or by translations fallback values. But with_translations() does not seem to give me such opportunity! Country.with_translations(:ru).order('country_translations.name ASC') #this

Globalize3 - two translations in one view

ε祈祈猫儿з 提交于 2019-12-11 13:06:41
问题 I use gem globalize3. I want to get a translation posts in two languages​​, first in English and then in Russian in one index view. And I want to post that is not in English, was located below in Russian after the English posts. My problem is that since I have a default locale :en, and if: @posts = Post.with_translations(:en) I get posts in english as I need, if: @posts_ru = Post.with_translations(:ru) I get posts in english too..Probably because the default locale English How I can get

i18n search using tire and Globalize3

这一生的挚爱 提交于 2019-12-11 03:36:42
问题 i have a site that uses globalize3 gem (https://github.com/svenfuchs/globalize3) and i'm currently adding the Tire gem to make site search. How do i do to Index a table translations depending on the actual locale? right now the model that gets indexed only does with the default locale. 回答1: You'd have to index all the translations: class Centre < ActiveRecord::Base include Tire::Model::Search include Tire::Model::Callbacks mapping do indexes :title_en, :as => lambda { |post| I18n.locale = :en

Redirect same page to different language with Globalize & Friendly_id

三世轮回 提交于 2019-12-07 01:07:10
问题 I've been scratching my head for the last few hours, looking for an answer but I can't find it anywhere. My gem file: # Use globalize for translating models gem "globalize", github: "ncri/globalize" # for Rails 4.2 gem 'globalize-accessors', '~> 0.1.5' # Use friendly_id for slugs gem 'friendly_id', '~> 5.1.0' gem 'friendly_id-globalize', '~> 1.0.0.alpha1' Here's the situation: I have two languages "en" and "fr" 2 models : pages and pages_translations pages has a slug column, pages

Redirect same page to different language with Globalize & Friendly_id

做~自己de王妃 提交于 2019-12-05 04:16:55
I've been scratching my head for the last few hours, looking for an answer but I can't find it anywhere. My gem file: # Use globalize for translating models gem "globalize", github: "ncri/globalize" # for Rails 4.2 gem 'globalize-accessors', '~> 0.1.5' # Use friendly_id for slugs gem 'friendly_id', '~> 5.1.0' gem 'friendly_id-globalize', '~> 1.0.0.alpha1' Here's the situation: I have two languages "en" and "fr" 2 models : pages and pages_translations pages has a slug column, pages_translations also has a slug column. if I view the page -> en/pages/slug-en, it works. if I view the page -> fr

Simple search on a Globalize3 table in Rails

醉酒当歌 提交于 2019-12-05 00:47:44
问题 I am looking to implement a simple search function while using the globalize3 gem for Ruby on Rails. Since the translations of the model are stored in a separate table, the code below doesn't work as there is no longer a :name field in the products table. How can I adjust the code below to make the search function correctly? products_controller.rb @products = Product.search(params[:search]).all index.html.erb <%= form_tag products_path, method: :get do %> <%= text_field_tag :search, params[