diff --git a/app/components/bikes.rb b/app/components/bikes.rb index 6b2f864..918fc0f 100644 --- a/app/components/bikes.rb +++ b/app/components/bikes.rb @@ -2,7 +2,6 @@ class Bikes < Netzke::Basepack::Grid def configure(c) super c.model = "Bike" - c.data_store.sorters = [{ :property => :shop_id, :direction => :ASC}] # columns with :id set, have :min_chars set in init_component # See: http://stackoverflow.com/questions/17738962/netzke-grid-filtering diff --git a/app/components/users.rb b/app/components/users.rb index 34086d5..0109b4d 100644 --- a/app/components/users.rb +++ b/app/components/users.rb @@ -13,7 +13,6 @@ class Users < Netzke::Basepack::Grid c.header = false c.model = "User" - c.data_store.sorters = [{ :property => :username, :direction => :ASC}] c.columns = [ { :name => :username, :read_only => true }, :first_name, diff --git a/app/models/bike.rb b/app/models/bike.rb index aced28e..722b1b2 100644 --- a/app/models/bike.rb +++ b/app/models/bike.rb @@ -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 } diff --git a/app/models/user.rb b/app/models/user.rb index 4abeda3..5c7ed67 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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