**Move pagination out of the model**~
- The pagination logic is only needed in a single
action in a single controller, so move it out of the model and into
that one action. - Because pagination was the only customization
that stratify-rails made to the Stratify::Activity model, we can
remove that file from the Rails app altogether. (The core
implementation of Stratify::Activity remains in the stratify-base gem.) - This also restores the desired pagination
behavior (i.e., 200 per page, as opposed to the default of 25 per page)
which got borked in commit 4d75b0e.
**Showing 2 changed files with 1 addition and
7 deletions. Show Diff Stats
- 2 stratify-rails/app/controllers\
- activities_controller.rb
- 6 stratify-rails/app/models/stratify/
- activity.rb
... ... @@ -5,7 +5,7 @@ def index 5 5 # TODO Simplify the logic below once
this bug is fixed in Kaminari:6 6 # https://github.com/amatsuda/
kaminari/issues/1457 7 activity_criteria = Stratify::Activity.desc(:created_at) 8 - @activities = Kaminari.paginate_array(activity_criteria).page(params[:page]) 8 + @activities = Kaminari.paginate_array(activity_criteria).page(params[:page]).per(200) 9 9 end 10 10 11 11 def destroy
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
沒有留言:
張貼留言
if you like make fds, wellcome you here~~anytime***
my free place for everyones who want the good software,
come & download them~ wellcome!!