Module: ActiveRecord::Mysql::Enum
- Defined in:
- lib/active_record/mysql/enum.rb,
lib/active_record/mysql/enum/version.rb,
lib/active_record/mysql/enum/mysql_adapter.rb,
lib/active_record/mysql/enum/enum_column_adapter.rb
Defined Under Namespace
Modules: EnumColumnAdapter, MysqlAdapter
Classes: Railtie
Constant Summary
collapse
- VERSION =
"2.4.2"
- ActiveRecordMysqlAdapter =
Enum.mysql_adapter
- ActiveRecordColumnWithEnums =
Enum.mysql_column_adapter
Class Method Summary
collapse
Class Method Details
.initialize! ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/active_record/mysql/enum.rb', line 7
def initialize!
require 'active_record/mysql/enum/mysql_adapter'
require 'active_record/mysql/enum/enum_type'
require 'active_record/mysql/enum/enum_column_adapter'
require 'active_record/mysql/enum/schema_definitions'
require 'active_record/mysql/enum/validations'
end
|
.mysql_column_adapter ⇒ Object
.register_enum_with_type_mapping(m) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/active_record/mysql/enum/mysql_adapter.rb', line 13
def register_enum_with_type_mapping(m)
m.register_type(/enum/i) do |sql_type|
limit = sql_type.to_s.sub(/^enum\('(.+)'\)/i, '\1').split("','").map { |v| v.to_sym }
ActiveRecord::Type::Enum.new(limit: limit)
end
end
|