Class: ActiveRecord::ConnectionAdapters::Mysql2DowncaseAdapter
- Inherits:
-
Mysql2Adapter
- Object
- Mysql2Adapter
- ActiveRecord::ConnectionAdapters::Mysql2DowncaseAdapter
- Defined in:
- lib/active_record/connection_adapters/mysql2_downcase_adapter.rb
Constant Summary collapse
- ADAPTER_NAME =
'Mysql2Downcase'
Instance Method Summary collapse
-
#pk_and_sequence_for(table) ⇒ Object
Это чтобы нормально определся primary_key.
Instance Method Details
#pk_and_sequence_for(table) ⇒ Object
Это чтобы нормально определся primary_key
58 59 60 61 62 63 64 65 |
# File 'lib/active_record/connection_adapters/mysql2_downcase_adapter.rb', line 58 def pk_and_sequence_for(table) keys = [] result = execute("DESCRIBE #{quote_table_name(table)}", 'SCHEMA') result.each(:symbolize_keys => true, :as => :hash) do |row| keys << row[:Field].downcase if row[:Key] == "PRI" end keys.length == 1 ? [keys.first, nil] : nil end |