Permalink
Browse files

Since we're using Inflector, use #constantize to find the right adapter

  • Loading branch information...
Scott Burton
Scott Burton committed Apr 1, 2012
1 parent c54d7d6 commit 5f1454e4f7aeb9df4092d98640c2ee0910426a75
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/badgeable/adapters.rb
@@ -14,8 +14,8 @@ def self.supported_adapters
end
def self.connect(klass)
- raise ArgumentError, "Badgeable needs a database adapter to work. Add one of the following to your Gemfile: #{Badgeable::Adapters.supported_adapters.map {|name| 'badgeable_' + name }}" unless Badgeable::Adapters.current && (Badgeable::Adapters.supported_adapters.include? Badgeable::Adapters.current)
- klass.send(:include, Badgeable::Adapters.const_get(Badgeable::Adapters.current.titleize + "Adapter" ))
+ raise ArgumentError, "Badgeable needs a database adapter to work. Add one of the following to your Gemfile: #{Badgeable::Adapters.supported_adapters.map {|name| 'badgeable_' + name }}" unless Badgeable::Adapters.current_adapter && (Badgeable::Adapters.supported_adapters.include? Badgeable::Adapters.current_adapter)
+ klass.send(:include, "Badgeable::Adapters::#{current_adapter.to_s.camelize}Adapter".constantize)
end
end
end

0 comments on commit 5f1454e

Please sign in to comment.