app/controllers/cohortly/metrics_controller.rb in cohortly-0.0.1 vs app/controllers/cohortly/metrics_controller.rb in cohortly-0.0.2

- old
+ new

@@ -1,14 +1,14 @@ class Cohortly::MetricsController < Cohortly::CohortlyController def index @metric_search = Cohortly::Metric.new(params[:cohortly_metric]) - scope = Cohortly::Metric.limit(250).sort(:created_at.desc) - if params[:tags] - scope = scope.where(:tags => { :$all => params[:tags] }) + scope = Cohortly::Metric.sort(:created_at.desc) + if params[:cohortly_metric] && params[:cohortly_metric][:tags] + scope = scope.where(:tags => { :$all => @metric_search.tags }) end if @metric_search.user_id scope = scope.where(:user_id => @metric_search.user_id) end - @metrics = scope.all + @metrics = scope.paginate(:per_page => 200, :page => params[:page]) end end