Module: ActiveRecordInlineSchema::ActiveRecordClassMethods
- Defined in:
- lib/active_record_inline_schema/active_record_class_methods.rb
Constant Summary collapse
- MUTEX =
::Mutex.new
Instance Method Summary collapse
-
#add_index(column_name, options = {}) ⇒ Object
this is not a typo - specify column name, not index name.
- #auto_upgrade!(options = {}) ⇒ Object
- #col(column_name, options = {}) ⇒ Object
- #inline_schema_config ⇒ Object
Instance Method Details
#add_index(column_name, options = {}) ⇒ Object
this is not a typo - specify column name, not index name
20 21 22 |
# File 'lib/active_record_inline_schema/active_record_class_methods.rb', line 20 def add_index(column_name, = {}) inline_schema_config.add_ideal_index column_name, end |
#auto_upgrade!(options = {}) ⇒ Object
24 25 26 |
# File 'lib/active_record_inline_schema/active_record_class_methods.rb', line 24 def auto_upgrade!( = {}) inline_schema_config.apply end |
#col(column_name, options = {}) ⇒ Object
15 16 17 |
# File 'lib/active_record_inline_schema/active_record_class_methods.rb', line 15 def col(column_name, = {}) inline_schema_config.add_ideal_column column_name, end |
#inline_schema_config ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/active_record_inline_schema/active_record_class_methods.rb', line 6 def inline_schema_config if superclass != ::ActiveRecord::Base return base_class.inline_schema_config end @inline_schema_config || MUTEX.synchronize do @inline_schema_config ||= ::ActiveRecordInlineSchema::Config.new self end end |