From 2876a201481fb5d983b580cc5173b3d0e3a67474 Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Sat, 8 Dec 2012 16:56:16 -0500 Subject: [PATCH] Edit to brand and model models --- app/models/bike_brand.rb | 6 +++++- app/models/bike_model.rb | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/models/bike_brand.rb b/app/models/bike_brand.rb index fb91e83..144c388 100644 --- a/app/models/bike_brand.rb +++ b/app/models/bike_brand.rb @@ -1,5 +1,5 @@ class BikeBrand < ActiveRecord::Base - attr_accessible :name + attr_accessible :brand has_many :bikes has_many :bike_models @@ -9,4 +9,8 @@ class BikeBrand < ActiveRecord::Base def models self.bike_models end + + def to_s + self.brand + end end diff --git a/app/models/bike_model.rb b/app/models/bike_model.rb index 5c18481..c01c5c7 100644 --- a/app/models/bike_model.rb +++ b/app/models/bike_model.rb @@ -1,10 +1,16 @@ class BikeModel < ActiveRecord::Base - attr_accessible :name + attr_accessible :model has_many :bikes belongs_to :bike_brand + self.per_page = 15 + def brand self.bike_brand end + + def to_s + self.model + end end