mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 16:53:23 -05:00
Add BikeBrand and BikeModel models
This commit is contained in:
parent
a307d5f6d5
commit
ff640580be
10
app/models/bike_brand.rb
Normal file
10
app/models/bike_brand.rb
Normal file
@ -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
|
10
app/models/bike_model.rb
Normal file
10
app/models/bike_model.rb
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user