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)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.0.4)
|
||||
rb-fsevent (0.9.3)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
rspec (2.8.0)
|
||||
@ -242,7 +241,6 @@ DEPENDENCIES
|
||||
pg
|
||||
pry (~> 0.9.8)
|
||||
rails (= 3.2.13)
|
||||
rb-fsevent
|
||||
rspec-rails (~> 2.8.1)
|
||||
shoulda-matchers (~> 1.0.0)
|
||||
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
|
||||
c.prohibit_update = true if cannot? :update, @bike
|
||||
c.prohibit_create = true if cannot? :create, @bike
|
||||
|
@ -12,9 +12,7 @@ class Bike < ActiveRecord::Base
|
||||
belongs_to :bike_condition
|
||||
belongs_to :bike_purpose
|
||||
|
||||
default_scope order('shop_id ASC')
|
||||
|
||||
validates :shop_id, :presence => true, :uniqueness => true, :length => { :minimum => 3 }
|
||||
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
|
||||
|
@ -11,7 +11,7 @@
|
||||
#
|
||||
# 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|
|
||||
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.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "shop_id"
|
||||
t.string "model"
|
||||
t.integer "shop_id"
|
||||
end
|
||||
|
||||
add_index "bikes", ["shop_id"], :name => "index_bikes_on_shop_id", :unique => true
|
||||
|
||||
create_table "credit_conversions", :force => true do |t|
|
||||
t.integer "conversion", :default => 1
|
||||
t.datetime "created_at", :null => false
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :bike do
|
||||
sequence :shop_id do |n|
|
||||
"Shop ID #{n}"
|
||||
end
|
||||
sequence(:shop_id) {|n| n}
|
||||
sequence :serial_number do |n|
|
||||
"S/N# #{n}"
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user