Adds User#for_render
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
class Admin::OfficialsController < Admin::BaseController
|
class Admin::OfficialsController < Admin::BaseController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@officials = User.officials.page(params[:page])
|
@officials = User.officials.page(params[:page]).for_render
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
@users = User.with_email(params[:email]).page(params[:page])
|
@users = User.with_email(params[:email]).page(params[:page]).for_render
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@@ -29,4 +29,4 @@ class Admin::OfficialsController < Admin::BaseController
|
|||||||
params.require(:user).permit(:official_position, :official_level)
|
params.require(:user).permit(:official_position, :official_level)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ class User < ActiveRecord::Base
|
|||||||
|
|
||||||
accepts_nested_attributes_for :organization
|
accepts_nested_attributes_for :organization
|
||||||
|
|
||||||
default_scope { includes(:organization) }
|
|
||||||
scope :administrators, -> { joins(:administrators) }
|
scope :administrators, -> { joins(:administrators) }
|
||||||
scope :moderators, -> { joins(:moderator) }
|
scope :moderators, -> { joins(:moderator) }
|
||||||
scope :organizations, -> { joins(:organization) }
|
scope :organizations, -> { joins(:organization) }
|
||||||
scope :officials, -> { where("official_level > 0") }
|
scope :officials, -> { where("official_level > 0") }
|
||||||
|
scope :for_render, -> { includes(:organization) }
|
||||||
|
|
||||||
def self.find_for_oauth(auth, signed_in_resource = nil)
|
def self.find_for_oauth(auth, signed_in_resource = nil)
|
||||||
# Get the identity and user if they exist
|
# Get the identity and user if they exist
|
||||||
|
|||||||
Reference in New Issue
Block a user