Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Build AR condition hashes dynamically
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

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
Something went wrong with that request. Please try again.