mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 08:31:36 -04:00
Use models to sort data when possible
This commit is contained in:
@@ -12,6 +12,8 @@ class Bike < ActiveRecord::Base
|
||||
belongs_to :bike_condition
|
||||
belongs_to :bike_purpose
|
||||
|
||||
default_scope order('shop_id ASC')
|
||||
|
||||
validates :shop_id, :presence => true, :uniqueness => true, :length => { :minimum => 3 }
|
||||
validates :serial_number, :length => { :minimum => 3 }
|
||||
validates :model, :length => { :maximum => 50 }
|
||||
|
||||
@@ -20,6 +20,8 @@ class User < ActiveRecord::Base
|
||||
|
||||
belongs_to :bike
|
||||
|
||||
default_scope order('username ASC')
|
||||
|
||||
validates :first_name, :presence => true
|
||||
validates :last_name, :presence => true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user