mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 08:31:36 -04:00
Fix validations for creating a bike, view respond to errors
This commit is contained in:
+6
-6
@@ -16,13 +16,13 @@ class Bike < ActiveRecord::Base
|
||||
validates :shop_id, :presence => true, :uniqueness => true, :numericality => { :only_integer => true }
|
||||
validates :serial_number, :length => { :minimum => 3 }
|
||||
validates :model, :length => { :maximum => 50 }
|
||||
validates :bike_brand_id, :presence => true
|
||||
validates :bike_brand_id, :presence => true, :numericality => { greater_than: 0, message: "is not a valid brand" }
|
||||
#validates :color, :presence => true
|
||||
validates :bike_style_id, :presence => true
|
||||
validates :seat_tube_height, :presence => true
|
||||
validates :bike_wheel_size_id, :presence => true
|
||||
validates :bike_condition_id, :presence => true
|
||||
validates :bike_purpose_id, :presence => true
|
||||
validates :bike_style_id, :presence => true, :numericality => { greater_than: 0, message: "is not a valid style" }
|
||||
validates :seat_tube_height, :presence => true, :numericality => true
|
||||
validates :bike_wheel_size_id, :presence => true, :numericality => { greater_than: 0, message: "is not a valid wheel size" }
|
||||
validates :bike_condition_id, :presence => true, :numericality => { greater_than: 0, message: "is not a valid condition" }
|
||||
validates :bike_purpose_id, :presence => true, :numericality => { greater_than: 0, message: "is not a valid purpose" }
|
||||
|
||||
self.per_page = 15
|
||||
|
||||
|
||||
Reference in New Issue
Block a user