Closed ermolaev closed 1 year ago
Hello @SamSaffron, what do you think of this PR?
I think it looks good, we are adding one call frame?
yes, to_sql
is public method, we already have to_sql
in builder
this PR unifies the public API and shortens the code, for example
SQL = MINI_SQL.build(<<~SQL).to_sql(state: LineItem::STATE::IN_DELIVERY)
SELECT * from line_items WHERE order_id = :order_id AND state = :state
SQL
SQL = MINI_SQL.to_sql(<<~SQL, LineItem::STATE::IN_DELIVERY)
SELECT * from line_items WHERE order_id = :order_id AND state = ?
SQL
MINI_SQL.prepared.query(SQL, order_id: order.id)