module ViewData::PG::Controls::Row::Get
Public Class Methods
call(primary_key, table: nil)
click to toggle source
# File lib/view_data/pg/controls/row/get.rb, line 6 def self.call(primary_key, table: nil) table ||= Table.name session = Session.build result = session.execute(<<~SQL, [primary_key]) SELECT * FROM #{table} WHERE id = $1 LIMIT 1 SQL session.close result.to_a[0] end