From a95604ce7caa3ca1ba9d7884b8e1f96e55033b82 Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Tue, 20 Oct 2015 16:29:09 -0600 Subject: [PATCH] Allow non-standard devise user class names --- lib/redactor-rails.rb | 4 ++++ lib/redactor-rails/orm/active_record.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/redactor-rails.rb b/lib/redactor-rails.rb index 9f7c5931..b6fc232d 100644 --- a/lib/redactor-rails.rb +++ b/lib/redactor-rails.rb @@ -38,4 +38,8 @@ def self.devise_user def self.devise_user_key "#{self.devise_user.to_s}_id".to_sym end + + def self.devise_user_class_name + "User" + end end diff --git a/lib/redactor-rails/orm/active_record.rb b/lib/redactor-rails/orm/active_record.rb index 3ab7ef08..0cce209f 100644 --- a/lib/redactor-rails/orm/active_record.rb +++ b/lib/redactor-rails/orm/active_record.rb @@ -15,7 +15,7 @@ def self.extended(base) self.table_name = "redactor_assets" belongs_to :assetable, :polymorphic => true - belongs_to RedactorRails.devise_user, :foreign_key => RedactorRails.devise_user_key + belongs_to RedactorRails.devise_user, :foreign_key => RedactorRails.devise_user_key, :class_name => RedactorRails.devise_user_class_name if defined?(ActiveModel::ForbiddenAttributesProtection) && base.ancestors.include?(ActiveModel::ForbiddenAttributesProtection) # Ok