Adds User#for_render

This commit is contained in:
kikito
2015-08-26 19:41:55 +02:00
parent 48ef4df0c3
commit b9634cffab
2 changed files with 4 additions and 4 deletions

View File

@@ -1,11 +1,11 @@
class Admin::OfficialsController < Admin::BaseController
def index
@officials = User.officials.page(params[:page])
@officials = User.officials.page(params[:page]).for_render
end
def search
@users = User.with_email(params[:email]).page(params[:page])
@users = User.with_email(params[:email]).page(params[:page]).for_render
end
def edit

View File

@@ -25,11 +25,11 @@ class User < ActiveRecord::Base
accepts_nested_attributes_for :organization
default_scope { includes(:organization) }
scope :administrators, -> { joins(:administrators) }
scope :moderators, -> { joins(:moderator) }
scope :organizations, -> { joins(:organization) }
scope :officials, -> { where("official_level > 0") }
scope :for_render, -> { includes(:organization) }
def self.find_for_oauth(auth, signed_in_resource = nil)
# Get the identity and user if they exist