Add a localised description to the tracks
This commit is contained in:
parent
0588b48084
commit
465418cf1d
@ -5,6 +5,8 @@ class Track < ActiveRecord::Base
|
|||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
validates :color, presence: true, format: {with: /\A[a-f0-9]{6}\z/i}
|
validates :color, presence: true, format: {with: /\A[a-f0-9]{6}\z/i}
|
||||||
|
|
||||||
|
translates :name, :description
|
||||||
|
|
||||||
def color=(hex_triplet)
|
def color=(hex_triplet)
|
||||||
write_attribute :color, hex_triplet.gsub(/\A#/,'') if hex_triplet
|
write_attribute :color, hex_triplet.gsub(/\A#/,'') if hex_triplet
|
||||||
end
|
end
|
||||||
|
@ -1 +1,6 @@
|
|||||||
li = track.name
|
li
|
||||||
|
strong
|
||||||
|
= track.name
|
||||||
|
\-
|
||||||
|
span
|
||||||
|
= track.description
|
||||||
|
@ -9,6 +9,6 @@ class AddTranslationTablesToConferences < ActiveRecord::Migration
|
|||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
Post.drop_translation_table! :migrate_data => true
|
Conference.drop_translation_table! :migrate_data => true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
5
db/migrate/20140906151300_add_description_to_tracks.rb
Normal file
5
db/migrate/20140906151300_add_description_to_tracks.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class AddDescriptionToTracks < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :tracks, :description, :text
|
||||||
|
end
|
||||||
|
end
|
@ -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
|
Loading…
Reference in New Issue
Block a user