Permalink
Browse files

show unscoped if logged in, so that plugins can change default_scope

  • Loading branch information...
1 parent b107de8 commit 14e0d6c5ac72241a841c821c3fa219fe43c493da @carpeliam committed May 16, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 app/controllers/governor/articles_controller.rb
@@ -15,10 +15,12 @@ class Governor::ArticlesController < ApplicationController
# GET /articles
# GET /articles.xml
def index
+ # if plugins modify default scope, show everything if user is logged in
+ collection = governor_logged_in? ? model_class.unscoped : model_class
set_resources(if model_class.respond_to?(:paginate)
- model_class.paginate :page => params[:page], :order => 'created_at DESC'
+ collection.paginate :page => params[:page], :order => 'created_at DESC'
else
- model_class.all :order => 'created_at DESC'
+ collection.all :order => 'created_at DESC'
end)
respond_with resources
end

0 comments on commit 14e0d6c

Please sign in to comment.