Louis | user can mark bikes as picked up from the available freecyclery bikes page

This commit is contained in:
Loos
2014-12-22 13:50:21 -06:00
parent d0a91882e3
commit 157712ac67
5 changed files with 23 additions and 8 deletions
+6 -1
View File
@@ -16,7 +16,7 @@ class Bike < ActiveRecord::Base
def ready_for_pickup?
client = self.client
client && self.completion_date && !client.application_voided
client && self.completion_date && !client.application_voided && self.date_sold.nil?
end
def self.bikes_ready_for_pickup
@@ -27,4 +27,9 @@ class Bike < ActiveRecord::Base
Bike.all.select{|bike| bike.completion_date && (bike.purpose == "Freecyclery") && !bike.client }
end
def mark_picked_up
current_date = Time.new.strftime("%Y-%m-%d")
self.update_attribute(:date_sold, current_date)
end
end