Browse Source

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

master
Louis Knapp 9 years ago
parent
commit
8a585c1e74
  1. 2
      app/helpers/bikes_helper.rb
  2. 2
      app/models/bike.rb
  3. 2
      app/views/clients/_fields.html.haml

2
app/helpers/bikes_helper.rb

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

2
app/models/bike.rb

@ -24,7 +24,7 @@ class Bike < ActiveRecord::Base
end
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
def mark_picked_up

2
app/views/clients/_fields.html.haml

@ -53,7 +53,7 @@
.form-group
= f.label "Bike:", class: "col-sm-2 control-label"
.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
= f.label "Agency:", class: "col-sm-2 control-label"

Loading…
Cancel
Save