mirror of
				https://github.com/fspc/BikeShed-1.git
				synced 2025-10-31 08:55:36 -04:00 
			
		
		
		
	Use models to sort data when possible
This commit is contained in:
		
							parent
							
								
									de266e72d9
								
							
						
					
					
						commit
						ec5db646a0
					
				| @ -2,7 +2,6 @@ class Bikes < Netzke::Basepack::Grid | |||||||
|   def configure(c) |   def configure(c) | ||||||
|     super |     super | ||||||
|     c.model = "Bike" |     c.model = "Bike" | ||||||
|     c.data_store.sorters = [{ :property => :shop_id, :direction => :ASC}] |  | ||||||
| 
 | 
 | ||||||
|     # columns with :id set, have :min_chars set in init_component |     # columns with :id set, have :min_chars set in init_component | ||||||
|     # See: http://stackoverflow.com/questions/17738962/netzke-grid-filtering |     # See: http://stackoverflow.com/questions/17738962/netzke-grid-filtering | ||||||
|  | |||||||
| @ -13,7 +13,6 @@ class Users < Netzke::Basepack::Grid | |||||||
|     c.header = false |     c.header = false | ||||||
|     c.model = "User" |     c.model = "User" | ||||||
| 
 | 
 | ||||||
|     c.data_store.sorters = [{ :property => :username, :direction => :ASC}] |  | ||||||
|     c.columns = [ |     c.columns = [ | ||||||
|       { :name => :username, :read_only => true }, |       { :name => :username, :read_only => true }, | ||||||
|       :first_name, |       :first_name, | ||||||
|  | |||||||
| @ -12,6 +12,8 @@ class Bike < ActiveRecord::Base | |||||||
|   belongs_to :bike_condition |   belongs_to :bike_condition | ||||||
|   belongs_to :bike_purpose |   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, :length => { :minimum => 3 } | ||||||
|   validates :serial_number, :length => { :minimum => 3 } |   validates :serial_number, :length => { :minimum => 3 } | ||||||
|   validates :model, :length => { :maximum => 50 } |   validates :model, :length => { :maximum => 50 } | ||||||
|  | |||||||
| @ -20,6 +20,8 @@ class User < ActiveRecord::Base | |||||||
| 
 | 
 | ||||||
|   belongs_to :bike |   belongs_to :bike | ||||||
| 
 | 
 | ||||||
|  |   default_scope order('username ASC') | ||||||
|  | 
 | ||||||
|   validates :first_name, :presence => true |   validates :first_name, :presence => true | ||||||
|   validates :last_name, :presence => true |   validates :last_name, :presence => true | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user