|
|
@ -1,7 +1,7 @@ |
|
|
|
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, |
|
|
|
:top_tube_length, :wheel_size, :value, :bike_condition_id, :bike_status_id |
|
|
|
:top_tube_length, :wheel_size, :value, :bike_condition_id, :bike_purpose_id |
|
|
|
|
|
|
|
has_many :transactions |
|
|
|
|
|
|
@ -11,7 +11,7 @@ class Bike < ActiveRecord::Base |
|
|
|
belongs_to :bike_model |
|
|
|
belongs_to :bike_style |
|
|
|
belongs_to :bike_condition |
|
|
|
belongs_to :bike_status |
|
|
|
belongs_to :bike_purpose |
|
|
|
|
|
|
|
validates :shop_id, :presence => true, :uniqueness => true, :length => { :minimum => 3 } |
|
|
|
validates :serial_number, :length => { :minimum => 3 } |
|
|
@ -24,7 +24,7 @@ class Bike < ActiveRecord::Base |
|
|
|
validates :wheel_size, :presence => true |
|
|
|
#validates :value, :presence => true |
|
|
|
validates :bike_condition_id, :presence => true |
|
|
|
validates :bike_status_id, :presence => true |
|
|
|
validates :bike_purpose_id, :presence => true |
|
|
|
|
|
|
|
self.per_page = 15 |
|
|
|
|
|
|
@ -46,8 +46,8 @@ class Bike < ActiveRecord::Base |
|
|
|
self.bike_condition |
|
|
|
end |
|
|
|
|
|
|
|
def status |
|
|
|
self.bike_status |
|
|
|
def purpose |
|
|
|
self.bike_purpose |
|
|
|
end |
|
|
|
|
|
|
|
def to_s |
|
|
|