Module: Internationalize::Adapters
- Defined in:
- lib/internationalize/adapters.rb,
lib/internationalize/adapters/base.rb,
lib/internationalize/adapters/mysql.rb,
lib/internationalize/adapters/sqlite.rb,
lib/internationalize/adapters/postgresql.rb
Defined Under Namespace
Classes: Base, MySQL, PostgreSQL, SQLite, UnsupportedAdapter
Class Method Summary collapse
-
.resolve(connection = ActiveRecord::Base.connection) ⇒ Internationalize::Adapters::Base
Returns the appropriate SQL generator for the current database Detection is based on ActiveRecord's connection adapter name.
Class Method Details
.resolve(connection = ActiveRecord::Base.connection) ⇒ Internationalize::Adapters::Base
Returns the appropriate SQL generator for the current database Detection is based on ActiveRecord's connection adapter name
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/internationalize/adapters.rb', line 16 def resolve(connection = ActiveRecord::Base.connection) case connection.adapter_name.downcase when /sqlite/ SQLite.new when /postgres/ PostgreSQL.new when /mysql|trilogy/ MySQL.new else raise UnsupportedAdapter, "Database adapter '#{connection.adapter_name}' is not supported. " \ "Supported adapters: sqlite, postgresql, mysql" end end |