diff --git a/app/controllers/status_controller.rb b/app/controllers/status_controller.rb index 983eec1..d85633a 100644 --- a/app/controllers/status_controller.rb +++ b/app/controllers/status_controller.rb @@ -18,7 +18,7 @@ class StatusController < ApplicationController format.html { render :text => 'Sorry the statuses are not public' } end end - + end @@ -35,24 +35,20 @@ class StatusController < ApplicationController # display only 1 day by default params[:days] = 1 if !params[:days] - # set limits limit = (request.format == 'csv') ? 1000000 : 8000 limit = params[:results].to_i if (params[:results] and params[:results].to_i < 8000) # get feed based on conditions - @feeds = @channel.feeds.find( - :all, - :conditions => { :created_at => get_date_range(params) }, - :select => [:created_at, :entry_id, :status], - :order => 'created_at desc', - :limit => limit - ) + @feeds = @channel.feeds + .where(:created_at => get_date_range(params)) + .select([:created_at, :entry_id, :status]) + .order('created_at desc') + .limit(limit) # sort properly @feeds.reverse! - # set output correctly if request.format == 'xml' @channel_output = @channel.to_xml(channel_options).sub('', '').strip @@ -150,9 +146,10 @@ class StatusController < ApplicationController only += [:latitude] unless channel.latitude.nil? only += [:longitude] unless channel.longitude.nil? only += [:elevation] unless channel.elevation.nil? or channel.elevation.empty? - + return only end end +