Class: ExtractSpecificObject
- Inherits:
-
GeneralConfiguration
- Object
- GeneralConfiguration
- ExtractSpecificObject
- Defined in:
- lib/extract_specific_object.rb
Class Method Summary collapse
Methods inherited from GeneralConfiguration
Class Method Details
.call(id:, table:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/extract_specific_object.rb', line 9 def call(id:, table:) initialize_configuration return table_not_exist(table) unless ActiveRecord::Base.connection.tables.include?(table) result = ActiveRecord::Base.connection.execute("SELECT * FROM #{table} WHERE id='#{id}'").to_a return not_found(table, id) if result.blank? (result) associated_object = [{ table: table, attributes: result }] ExtractAssociatedObject.new(result, associated_object).call end |