From ff640580be8ae0f61d6caf9e03f48e852b6ff085 Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Sat, 8 Dec 2012 15:00:43 -0500 Subject: [PATCH] Add BikeBrand and BikeModel models --- app/models/bike_brand.rb | 10 ++++++++++ app/models/bike_model.rb | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 app/models/bike_brand.rb create mode 100644 app/models/bike_model.rb diff --git a/app/models/bike_brand.rb b/app/models/bike_brand.rb new file mode 100644 index 0000000..ed16f36 --- /dev/null +++ b/app/models/bike_brand.rb @@ -0,0 +1,10 @@ +class BikeBrand < ActiveRecord::Base + attr_accessible :name + + has_many :bikes + has_many :bike_models + + def models + self.bike_models + end +end diff --git a/app/models/bike_model.rb b/app/models/bike_model.rb new file mode 100644 index 0000000..5c18481 --- /dev/null +++ b/app/models/bike_model.rb @@ -0,0 +1,10 @@ +class BikeModel < ActiveRecord::Base + attr_accessible :name + + has_many :bikes + belongs_to :bike_brand + + def brand + self.bike_brand + end +end