From 4b82b4c4acde12a2273f7a56a104982381176edb Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Tue, 20 Oct 2015 10:13:42 +0300 Subject: [PATCH] Add translation tables to Halls --- app/models/hall.rb | 2 ++ .../20151020071227_add_translations_to_halls.rb | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 db/migrate/20151020071227_add_translations_to_halls.rb diff --git a/app/models/hall.rb b/app/models/hall.rb index 1bf42eb..86cca85 100644 --- a/app/models/hall.rb +++ b/app/models/hall.rb @@ -3,4 +3,6 @@ class Hall < ActiveRecord::Base has_many :slots, dependent: :destroy validates :name, presence: true + + translates :name end diff --git a/db/migrate/20151020071227_add_translations_to_halls.rb b/db/migrate/20151020071227_add_translations_to_halls.rb new file mode 100644 index 0000000..cb7e3b9 --- /dev/null +++ b/db/migrate/20151020071227_add_translations_to_halls.rb @@ -0,0 +1,13 @@ +class AddTranslationsToHalls < ActiveRecord::Migration + def self.up + Hall.create_translation_table!({ + :name => :string + }, { + :migrate_data => true + }) + end + + def self.down + Hall.drop_translation_table! :migrate_data => true + end +end