Permalink
Browse files

?

  • Loading branch information...
1 parent dacfaae commit d5ebae233c9fe072f822ea67e986c856cd01ef95 TEO Ultimus committed Oct 27, 2012
Showing with 7 additions and 2 deletions.
  1. +5 −1 app/controllers/bikes_controller.rb
  2. +2 −1 app/models/bike.rb
@@ -61,6 +61,10 @@ def index
@colors = Bike.all_colors
@statuses = Bike.all_statuses
@sorts = Bike.sort_filters
+
+ #filter_bikes()
+ #@bikes = Bike.filter_bikes(@brands,@colors,@statuses,[@sorts.first], true)
+ #render :json => @bikes
end
def edit
@@ -93,7 +97,7 @@ def filter_bikes
@color = params[:colors]
@status = params[:statuses]
@sortBy = params[:sortBy]
- @bikes = Bike.filter_bikes(@brand,@color,@status,@sortBy)
+ @bikes = Bike.filter_bikes(@brand,@color,@status,@sortBy, true)
render :json => @bikes
end
View
@@ -49,7 +49,8 @@ class Bike < ActiveRecord::Base
STATUSES = ["Available","EAB","Youth","Departed"]
- def self.filter_bikes(brands,colors,status,sortBy)
+ def self.filter_bikes(brands,colors,status,sortBy,ascending)
+ ascending ||= true
statusSql = []
if status.nil? or status.empty?
return []

0 comments on commit d5ebae2

Please sign in to comment.