FAQ Database Discussion Community


Ruby on Rails 4.2 with Globalize gem for UUID table

ruby-on-rails,postgresql,gem,uuid,globalize
I use Globalize gem for my rails 4.2 project, and the table primary ID is UUID in postgre. Here is the table migration codes and created translation table foreign key is integer type, not UUID. class CreateMessageThreads < ActiveRecord::Migration def up enable_extension 'uuid-ossp' create_table :message_threads, id: :uuid do |t| t.integer...

Switch locale on current page rails

ruby-on-rails,ruby,friendly-id,globalize
i'm currently working on a project which has 2 different locals (nl/fr). We're facing this problem : How can I get the translated url for the current page when I display fr/nl button I'm currently working with friendly_id and globalize we've tried : = link_to "nl", params.merge(locale: "nl") = link_to...

Rails and Globalize - join translation table of related model in scope

ruby-on-rails,ruby-on-rails-4,relationship,has-many-through,globalize
I want to order some records of a model that has a relation to another model (with translated attributes). Here an example: I have a model Project I have a model Task I have the relation Project has_many Tasks The model Task has attribute name globalized (on task_translations table) Now,...

Get an array of many objects associations

ruby-on-rails,ruby,has-many,globalize3,globalize
I didn't know exactly how to find an understandable title so I'll try my best to explain my problem. I have 2 models: - Country translatable with globalize, with a name and many regions - Region belongs_to country What I would like to do is geting an array of all...