1
0
mirror of https://github.com/fspc/bike-database.git synced 2025-02-23 01:23:24 -05:00

lk | all freecyclery bikes present in client drop-down, and they save

This commit is contained in:
Louis Knapp 2015-09-29 19:48:43 -05:00
parent b37a827655
commit 8a585c1e74
3 changed files with 2 additions and 4 deletions

View File

@ -1,2 +0,0 @@
module BikesHelper
end

View File

@ -24,7 +24,7 @@ class Bike < ActiveRecord::Base
end end
def self.available_for_freecyclery def self.available_for_freecyclery
Bike.all.select{|bike| bike.completion_date && (bike.purpose == "Freecyclery") && !bike.client } Bike.order(log_number: :desc).select{|bike| bike.completion_date && (bike.purpose == "Freecyclery")}
end end
def mark_picked_up def mark_picked_up

View File

@ -53,7 +53,7 @@
.form-group .form-group
= f.label "Bike:", class: "col-sm-2 control-label" = f.label "Bike:", class: "col-sm-2 control-label"
.col-sm-10 .col-sm-10
= f.select(:bike_id, Bike.all.collect {|b| [ b.name, b.id ] }, {include_blank: 'None'}) = f.select :bike_id, options_for_select( Bike.available_for_freecyclery.collect{|b| [ b.name, b.id ]}, @client.bike_id )
.form-group .form-group
= f.label "Agency:", class: "col-sm-2 control-label" = f.label "Agency:", class: "col-sm-2 control-label"