module ViewData::PG::Controls::Row::Get::CompositePrimaryKey

Public Class Methods

call(ids) click to toggle source
# File lib/view_data/pg/controls/row/get.rb, line 21
            def self.call(ids)
              id_1, id_2 = ids

              table = Table::CompositePrimaryKey.name

              session = Session.build

              result = session.execute(<<~SQL, [id_1, id_2])
                SELECT * FROM #{table} WHERE id_1 = $1 AND id_2 = $2 LIMIT 1
              SQL

              session.close

              result.to_a[0]
            end