@@ -547,28 +547,40 @@ module Clear::Model
547547 self .offset(range.begin).limit(range.end - range.begin).to_a(fetch_columns)
548548 end
549549
550- # A convenient way to write `where { condition }.first`
550+ # A convenient way to write `where { condition }.first(fetch_columns) `
551551 def find (fetch_columns = false , & block) : T ?
552552 x = Clear ::Expression .ensure_node!(with Clear ::Expression .new yield )
553+
553554 where(x).first(fetch_columns)
554555 end
555556
556- # A convenient way to write `where({any_column: "any_value"}).first`
557+ # A convenient way to write `where({any_column: "any_value"}).first(fetch_columns) `
557558 def find (tuple : NamedTuple , fetch_columns = false ) : T ?
558559 where(tuple).first(fetch_columns)
559560 end
560561
561- # A convenient way to write `where({any_column: "any_value"}).first!`
562+ # A convenient way to write `where({any_column: "any_value"}).first`
563+ def find (** tuple) : T ?
564+ where(tuple).first
565+ end
566+
567+ # A convenient way to write `where { condition }.first!(fetch_columns)`
562568 def find !(fetch_columns = false , & block) : T
563569 x = Clear ::Expression .ensure_node!(with Clear ::Expression .new yield )
570+
564571 where(x).first!(fetch_columns)
565572 end
566573
567- # A convenient way to write `where { condition } .first!`
574+ # A convenient way to write `where({any_column: "any_value"}) .first!(fetch_columns) `
568575 def find !(tuple : NamedTuple , fetch_columns = false ) : T
569576 where(tuple).first!(fetch_columns)
570577 end
571578
579+ # A convenient way to write `where({any_column: "any_value"}).first!`
580+ def find !(** tuple) : T
581+ where(tuple).first!
582+ end
583+
572584 # Try to fetch a row. If not found, build a new object and setup
573585 # the fields like setup in the condition tuple.
574586 def find_or_build (** tuple, & block : T - > Nil ) : T
0 commit comments