Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/que.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ def disable_prepared_statements
@disable_prepared_statements || false
end

def constantize(camel_cased_word)
if camel_cased_word.respond_to?(:constantize)
# Use ActiveSupport's version if it exists.
camel_cased_word.constantize
else
string.split('::').inject(Object, &:const_get)
end
end

# A helper method to manage transactions, used mainly by the migration
# system. It's available for general use, but if you're using an ORM that
# provides its own transaction helper, be sure to use that instead, or the
Expand Down
2 changes: 1 addition & 1 deletion lib/que/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def work(queue = '')
private

def class_for(string)
string.split('::').inject(Object, &:const_get)
Que.constantize(string)
end
end
end
Expand Down