mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 16:53:23 -05:00
Fixed default sort and added migration for shop_id => Integer
This commit is contained in:
parent
cfeb6fd1d2
commit
86ada003d6
@ -162,7 +162,6 @@ GEM
|
|||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (>= 0.14.6, < 2.0)
|
thor (>= 0.14.6, < 2.0)
|
||||||
rake (10.0.4)
|
rake (10.0.4)
|
||||||
rb-fsevent (0.9.3)
|
|
||||||
rdoc (3.12.2)
|
rdoc (3.12.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
rspec (2.8.0)
|
rspec (2.8.0)
|
||||||
@ -242,7 +241,6 @@ DEPENDENCIES
|
|||||||
pg
|
pg
|
||||||
pry (~> 0.9.8)
|
pry (~> 0.9.8)
|
||||||
rails (= 3.2.13)
|
rails (= 3.2.13)
|
||||||
rb-fsevent
|
|
||||||
rspec-rails (~> 2.8.1)
|
rspec-rails (~> 2.8.1)
|
||||||
shoulda-matchers (~> 1.0.0)
|
shoulda-matchers (~> 1.0.0)
|
||||||
spork
|
spork
|
||||||
|
@ -33,6 +33,10 @@ class Bikes < Netzke::Basepack::Grid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Default the sorting to ASC on shop_id
|
||||||
|
c.data_store.sorters = [{ property: 'shop_id', direction: 'ASC' }]
|
||||||
|
|
||||||
@bike = Bike.all
|
@bike = Bike.all
|
||||||
c.prohibit_update = true if cannot? :update, @bike
|
c.prohibit_update = true if cannot? :update, @bike
|
||||||
c.prohibit_create = true if cannot? :create, @bike
|
c.prohibit_create = true if cannot? :create, @bike
|
||||||
|
@ -12,9 +12,7 @@ class Bike < ActiveRecord::Base
|
|||||||
belongs_to :bike_condition
|
belongs_to :bike_condition
|
||||||
belongs_to :bike_purpose
|
belongs_to :bike_purpose
|
||||||
|
|
||||||
default_scope order('shop_id ASC')
|
validates :shop_id, :presence => true, :uniqueness => true, :numericality => { :only_integer => true }
|
||||||
|
|
||||||
validates :shop_id, :presence => true, :uniqueness => true, :length => { :minimum => 3 }
|
|
||||||
validates :serial_number, :length => { :minimum => 3 }
|
validates :serial_number, :length => { :minimum => 3 }
|
||||||
validates :model, :length => { :maximum => 50 }
|
validates :model, :length => { :maximum => 50 }
|
||||||
validates :bike_brand_id, :presence => true
|
validates :bike_brand_id, :presence => true
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20130902201853) do
|
ActiveRecord::Schema.define(:version => 20131019023429) do
|
||||||
|
|
||||||
create_table "bike_actions", :force => true do |t|
|
create_table "bike_actions", :force => true do |t|
|
||||||
t.string "action", :limit => 128, :null => false
|
t.string "action", :limit => 128, :null => false
|
||||||
@ -60,12 +60,10 @@ ActiveRecord::Schema.define(:version => 20130902201853) do
|
|||||||
t.integer "bike_purpose_id", :null => false
|
t.integer "bike_purpose_id", :null => false
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.string "shop_id"
|
|
||||||
t.string "model"
|
t.string "model"
|
||||||
|
t.integer "shop_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "bikes", ["shop_id"], :name => "index_bikes_on_shop_id", :unique => true
|
|
||||||
|
|
||||||
create_table "credit_conversions", :force => true do |t|
|
create_table "credit_conversions", :force => true do |t|
|
||||||
t.integer "conversion", :default => 1
|
t.integer "conversion", :default => 1
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :bike do
|
factory :bike do
|
||||||
sequence :shop_id do |n|
|
sequence(:shop_id) {|n| n}
|
||||||
"Shop ID #{n}"
|
|
||||||
end
|
|
||||||
sequence :serial_number do |n|
|
sequence :serial_number do |n|
|
||||||
"S/N# #{n}"
|
"S/N# #{n}"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user