Module: Qdocs::ActiveRecord::Helpers
Instance Method Summary collapse
Instance Method Details
#active_record_attributes_for(col) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/qdocs/active_record.rb', line 4 def active_record_attributes_for(col) if col.is_a? ::ActiveRecord::ConnectionAdapters::NullColumn raise UnknownMethodError, "Unknown attribute #{col.name}" end { type: col.&.type, comment: col.comment, default: col.default, null: col.null, default_function: col.default_function, name: col.name, } end |
#if_active_record(constant) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/qdocs/active_record.rb', line 19 def if_active_record(constant) if Object.const_defined?("::ActiveRecord::Base") && constant.respond_to?(:<) && constant < ::ActiveRecord::Base && !constant.abstract_class yield constant end end |