Class: Qdocs::ActiveRecord::Const
- Inherits:
-
Base::Const
- Object
- Base::Const
- Qdocs::ActiveRecord::Const
- Includes:
- Helpers
- Defined in:
- lib/qdocs/active_record.rb
Instance Method Summary collapse
Methods included from Helpers
#active_record_attributes_for, #if_active_record
Methods inherited from Base::Const
Methods included from Helpers
#find_constant, #own_methods, #params_to_hash, #render_response, #source_location_to_str
Constructor Details
This class inherits a constructor from Qdocs::Base::Const
Instance Method Details
#show(const) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/qdocs/active_record.rb', line 32 def show(const) database_attributes = {} constant = nil resp = super do |con| if_active_record(con) do |klass| constant = klass klass.columns.each do |col| database_attributes[col.name.to_sym] = active_record_attributes_for col end end end if constant { **resp, type: :active_record_class, attributes: { **resp[:attributes], database_attributes: database_attributes, }, } else resp end end |