diff --git a/app/models/track.rb b/app/models/track.rb index 6335631..80b8be3 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -5,6 +5,8 @@ class Track < ActiveRecord::Base validates :name, presence: true validates :color, presence: true, format: {with: /\A[a-f0-9]{6}\z/i} + translates :name, :description + def color=(hex_triplet) write_attribute :color, hex_triplet.gsub(/\A#/,'') if hex_triplet end diff --git a/app/views/home/_track.html.slim b/app/views/home/_track.html.slim index 2283ac2..c76c2fa 100644 --- a/app/views/home/_track.html.slim +++ b/app/views/home/_track.html.slim @@ -1 +1,6 @@ -li = track.name +li + strong + = track.name + \- + span + = track.description diff --git a/db/migrate/20140901103859_add_translation_tables_to_conferences.rb b/db/migrate/20140901103859_add_translation_tables_to_conferences.rb index ba159a8..4848e4b 100644 --- a/db/migrate/20140901103859_add_translation_tables_to_conferences.rb +++ b/db/migrate/20140901103859_add_translation_tables_to_conferences.rb @@ -9,6 +9,6 @@ class AddTranslationTablesToConferences < ActiveRecord::Migration end def down - Post.drop_translation_table! :migrate_data => true + Conference.drop_translation_table! :migrate_data => true end end diff --git a/db/migrate/20140906151300_add_description_to_tracks.rb b/db/migrate/20140906151300_add_description_to_tracks.rb new file mode 100644 index 0000000..e27dc9f --- /dev/null +++ b/db/migrate/20140906151300_add_description_to_tracks.rb @@ -0,0 +1,5 @@ +class AddDescriptionToTracks < ActiveRecord::Migration + def change + add_column :tracks, :description, :text + end +end diff --git a/db/migrate/20140906151433_add_translation_tables_to_tracks.rb b/db/migrate/20140906151433_add_translation_tables_to_tracks.rb new file mode 100644 index 0000000..28e3d8b --- /dev/null +++ b/db/migrate/20140906151433_add_translation_tables_to_tracks.rb @@ -0,0 +1,14 @@ +class AddTranslationTablesToTracks < ActiveRecord::Migration + def up + Track.create_translation_table!({ + name: :string, + description: :text + }, { + migrate_data: true + }) + end + + def down + Track.drop_translation_table! migrate_data: true + end +end