Build AR condition hashes dynamically
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
MIT-LICENSE
README
Rakefile

README

SqlConditionBuilder
===================

Build AR conditions easily.


Example
=======

builder = SqlConditionBuilder.new

@builder.add_condition "foo IS NULL"
@builder.add_condition "(bar = ? OR bar = ?)", 10, 20
@builder.baz = "something"

@builder.to_a    #=> ["foo IS NULL AND (bar = ? OR bar = ?) AND baz = ?", 10, 20, "something"]
@builder.to_sql  #=> "foo IS NULL AND (bar = 10 OR bar = 20) AND baz = 'something'"



Copyright (c) 2009 Scott Taylor / smtlaissezfaire <scott@railsnewbie.com>, released under the MIT license