Skip to content
This repository has been archived by the owner on Dec 31, 2018. It is now read-only.

Commit

Permalink
Update to latest version of kaminari (0.1.3)
Browse files Browse the repository at this point in the history
Updating to fix deprecation warning following Rails 3.2 upgrade:

  DEPRECATION WARNING: The InstanceMethods module inside
  ActiveSupport::Concern will be no longer included automatically. Please
  define instance methods directly in Kaminari::PageScopeMethods instead.
  (called from include at app/models/stratify/activity.rb:3)

Unfortunately, Kaminari 1.1.3 has an open bug related to Mongoid:

  https://github.com/amatsuda/kaminari/issues/145

For now, we will work around this bug (which rears its head in
ActivitiesController#index) by wrapping the Mongoid query results in a
call to Kaminari.paginate_array.
  • Loading branch information
jasonrudolph committed Apr 29, 2012
1 parent e02ff3a commit 4d75b0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions stratify-rails/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,18 @@ GEM
thor (~> 0.14)
json (1.7.0)
json_pure (1.5.1)
kaminari (0.12.4)
rails (>= 3.0.0)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
launchy (0.4.0)
configuration (>= 0.0.5)
rake (>= 0.8.1)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
mime-types (1.18)
mocha (0.9.12)
mongo (1.6.2)
bson (~> 1.6.2)
Expand Down
5 changes: 4 additions & 1 deletion stratify-rails/app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ class ActivitiesController < ApplicationController
before_filter :prompt_user_to_setup_collectors_if_no_activities_exist, :only => :index

def index
@activities = Stratify::Activity.desc(:created_at).page params[:page]
# TODO Simplify the logic below once this bug is fixed in Kaminari:
# https://github.com/amatsuda/kaminari/issues/145
activity_criteria = Stratify::Activity.desc(:created_at)
@activities = Kaminari.paginate_array(activity_criteria).page(params[:page])
end

def destroy
Expand Down

0 comments on commit 4d75b0e

Please sign in to comment.