From 922af526c17a69616077cb10468c88531cfdcaea Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Sat, 29 Dec 2012 16:22:46 -0500 Subject: [PATCH] Order bike brands and models alphabetically --- app/models/bike_brand.rb | 2 ++ app/models/bike_model.rb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/bike_brand.rb b/app/models/bike_brand.rb index 144c388..5373efa 100644 --- a/app/models/bike_brand.rb +++ b/app/models/bike_brand.rb @@ -4,6 +4,8 @@ class BikeBrand < ActiveRecord::Base has_many :bikes has_many :bike_models + default_scope order('brand ASC') + self.per_page = 15 def models diff --git a/app/models/bike_model.rb b/app/models/bike_model.rb index c01c5c7..df3c410 100644 --- a/app/models/bike_model.rb +++ b/app/models/bike_model.rb @@ -1,9 +1,11 @@ class BikeModel < ActiveRecord::Base - attr_accessible :model + attr_accessible :model, :bike_brand_id has_many :bikes belongs_to :bike_brand + default_scope order('model ASC') + self.per_page = 15 def brand