Merge pull request #61 from spacemunkay/denney-move-model-to-bike

Moving bike model to the bikes table
This commit is contained in:
Jason Denney
2013-09-02 14:28:06 -07:00
6 changed files with 17 additions and 13 deletions
+2 -7
View File
@@ -1,6 +1,6 @@
class Bike < ActiveRecord::Base
acts_as_loggable
attr_accessible :shop_id, :serial_number, :bike_brand_id, :bike_model_id, :color, :bike_style_id, :seat_tube_height,
attr_accessible :shop_id, :serial_number, :bike_brand_id, :model, :color, :bike_style_id, :seat_tube_height,
:top_tube_length, :wheel_size, :value, :bike_condition_id, :bike_purpose_id
has_many :transactions
@@ -8,15 +8,14 @@ class Bike < ActiveRecord::Base
has_one :owner, :class_name => 'User'
has_one :task_list, :as => :item, :dependent => :destroy
belongs_to :bike_brand
belongs_to :bike_model
belongs_to :bike_style
belongs_to :bike_condition
belongs_to :bike_purpose
validates :shop_id, :presence => true, :uniqueness => true, :length => { :minimum => 3 }
validates :serial_number, :length => { :minimum => 3 }
validates :model, :length => { :maximum => 50 }
validates :bike_brand_id, :presence => true
validates :bike_model_id, :presence => true
validates :color, :presence => true
validates :bike_style_id, :presence => true
validates :seat_tube_height, :presence => true
@@ -34,10 +33,6 @@ class Bike < ActiveRecord::Base
self.bike_brand
end
def model
self.bike_model
end
def style
self.bike_style
end
-1
View File
@@ -1,7 +1,6 @@
class BikeModel < ActiveRecord::Base
attr_accessible :model, :bike_brand_id
has_many :bikes
belongs_to :bike_brand
default_scope order('model ASC')