Fixed default sort and added migration for shop_id => Integer

This commit is contained in:
Ron Warholic
2013-10-18 23:44:12 -04:00
parent cfeb6fd1d2
commit 86ada003d6
5 changed files with 8 additions and 12 deletions
+4
View File
@@ -33,6 +33,10 @@ class Bikes < Netzke::Basepack::Grid
}
}
]
# Default the sorting to ASC on shop_id
c.data_store.sorters = [{ property: 'shop_id', direction: 'ASC' }]
@bike = Bike.all
c.prohibit_update = true if cannot? :update, @bike
c.prohibit_create = true if cannot? :create, @bike
+1 -3
View File
@@ -12,9 +12,7 @@ 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 :shop_id, :presence => true, :uniqueness => true, :numericality => { :only_integer => true }
validates :serial_number, :length => { :minimum => 3 }
validates :model, :length => { :maximum => 50 }
validates :bike_brand_id, :presence => true