aboutsummaryrefslogtreecommitdiffstats
path: root/lib/refinery
diff options
context:
space:
mode:
authorJonathan Seitel <jon.seitel@gmail.com>2013-01-31 22:23:49 -0800
committerJonathan Seitel <jon.seitel@gmail.com>2013-01-31 22:23:49 -0800
commit636383e630967c373d762ae2475f4f4e7e05f974 (patch)
treeebb5027be81e48f0f598981adbb1f5606bdf57c4 /lib/refinery
parentfe6831de448276a7a8d9aa035c8dfed1e31d546c (diff)
downloadrefinerycms-blog-636383e630967c373d762ae2475f4f4e7e05f974.tar.gz
refinerycms-blog-636383e630967c373d762ae2475f4f4e7e05f974.tar.bz2
refinerycms-blog-636383e630967c373d762ae2475f4f4e7e05f974.zip
Committing user_class to master
Diffstat (limited to 'lib/refinery')
-rw-r--r--lib/refinery/blog/configuration.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/refinery/blog/configuration.rb b/lib/refinery/blog/configuration.rb
index b7598e8..6198cb2 100644
--- a/lib/refinery/blog/configuration.rb
+++ b/lib/refinery/blog/configuration.rb
@@ -11,5 +11,28 @@ module Refinery
self.post_teaser_length = 250
self.share_this_key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
self.page_url = "/blog"
+
+ # Refinery::User isn't available when this line gets hit, so we use static methods instead
+ @@user_class_name = nil
+ class << self
+ def user_class=(class_name)
+ if class_name.is_a?(Class)
+ raise TypeError, "You can't set user_class to be a class, e.g., User. Instead, please use a string like 'User'"
+ elsif class_name.is_a?(String)
+ @@user_class_name = class_name
+ else
+ raise TypeError, "Invalid type for user_class. Please use a string like 'User'"
+ end
+ end
+
+ def user_class
+ class_name = @@user_class_name || 'Refinery::User'
+ begin
+ Object.const_get(class_name)
+ rescue NameError
+ class_name.constantize
+ end
+ end
+ end
end
end