Friendly urls for tracks
Don't use tracks ids in urls Add short_name to tracks and use that in urls as the identifier
This commit is contained in:
parent
882a1d20c9
commit
95fbd10153
9 changed files with 61 additions and 8 deletions
|
|
@ -7,6 +7,12 @@ class Track < ActiveRecord::Base
|
|||
before_create :generate_guid
|
||||
validates :name, presence: true
|
||||
validates :color, format: /\A#[0-9A-F]{6}\z/
|
||||
validates :short_name,
|
||||
presence: true,
|
||||
format: /\A[a-zA-Z0-9_-]*\z/,
|
||||
uniqueness: {
|
||||
scope: :program
|
||||
}
|
||||
|
||||
before_validation :capitalize_color
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue