diff --git a/Gemfile b/Gemfile index c6ea706..10d52dc 100644 --- a/Gemfile +++ b/Gemfile @@ -35,6 +35,8 @@ gem 'capistrano-rvm' gem 'puma' +gem 'globalize', '~> 4.0.2' + group :development do gem 'spring' gem 'spring-commands-rspec' diff --git a/Gemfile.lock b/Gemfile.lock index 86af20e..24c19a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,6 +97,9 @@ GEM i18n (~> 0.5) ffi (1.9.3) formatador (0.2.5) + globalize (4.0.2) + activemodel (>= 4.0.0, < 5) + activerecord (>= 4.0.0, < 5) guard (2.6.1) formatador (>= 0.2.4) listen (~> 2.7) @@ -268,6 +271,7 @@ DEPENDENCIES devise-i18n factory_girl_rails faker + globalize (~> 4.0.2) guard-rspec jquery-rails pg diff --git a/app/models/conference.rb b/app/models/conference.rb index 145b427..99f2c52 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -6,6 +6,8 @@ class Conference < ActiveRecord::Base validates :end_date, presence: true validate :end_date_is_before_start_date + translates :title, :description + has_many :tracks has_many :events, through: :tracks diff --git a/db/migrate/20140901103859_add_translation_tables_to_conferences.rb b/db/migrate/20140901103859_add_translation_tables_to_conferences.rb new file mode 100644 index 0000000..ba159a8 --- /dev/null +++ b/db/migrate/20140901103859_add_translation_tables_to_conferences.rb @@ -0,0 +1,14 @@ +class AddTranslationTablesToConferences < ActiveRecord::Migration + def up + Conference.create_translation_table!({ + :title => :string, + :description => :text + }, { + :migrate_data => true + }) + end + + def down + Post.drop_translation_table! :migrate_data => true + end +end