From be4b1766ef4963be1cf96109f98de84c82258aac Mon Sep 17 00:00:00 2001 From: jamesprior Date: Tue, 25 Mar 2014 11:10:24 -0400 Subject: [PATCH] Use Cms::PersistentUser instead of Cms::User for model relations and tasks so that ExternalUsers are included. --- app/models/cms/task.rb | 4 ++-- app/views/cms/tasks/new.html.erb | 2 +- lib/cms/behaviors/userstamping.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/cms/task.rb b/app/models/cms/task.rb index 796ddecb2..d06e83afa 100644 --- a/app/models/cms/task.rb +++ b/app/models/cms/task.rb @@ -4,8 +4,8 @@ class Task < ActiveRecord::Base CANT_ASSIGN_MESSAGE = "must have permission to assign tasks" CANT_BE_ASSIGNED_MESSAGE = "must have permission to be assigned tasks" include Cms::DomainSupport - belongs_to :assigned_by, :class_name => 'Cms::User' - belongs_to :assigned_to, :class_name => 'Cms::User' + belongs_to :assigned_by, :class_name => 'Cms::PersistentUser' + belongs_to :assigned_to, :class_name => 'Cms::PersistentUser' belongs_to :page, :class_name => 'Cms::Page' extend DefaultAccessible diff --git a/app/views/cms/tasks/new.html.erb b/app/views/cms/tasks/new.html.erb index 73e9fc77d..1a9360f83 100644 --- a/app/views/cms/tasks/new.html.erb +++ b/app/views/cms/tasks/new.html.erb @@ -10,7 +10,7 @@ <%= render layout: 'form_with_buttons', locals: {f: f} do %> <%= f.association :assigned_to, label: "Assign To", - collection: Cms::User.active.able_to_edit_or_publish_content.order("first_name, last_name, login"), + collection: Cms::PersistentUser.active.able_to_edit_or_publish_content.order("first_name, last_name, login"), include_blank: false, label_method: :full_name_with_login %> diff --git a/lib/cms/behaviors/userstamping.rb b/lib/cms/behaviors/userstamping.rb index 70540f894..b10d6236e 100644 --- a/lib/cms/behaviors/userstamping.rb +++ b/lib/cms/behaviors/userstamping.rb @@ -13,8 +13,8 @@ def is_userstamped(options={}) extend ClassMethods include InstanceMethods - belongs_to :created_by, :class_name => "Cms::User" - belongs_to :updated_by, :class_name => "Cms::User" + belongs_to :created_by, :class_name => "Cms::PersistentUser" + belongs_to :updated_by, :class_name => "Cms::PersistentUser" before_save :set_userstamps