Dyna Con plugin

Plugin details

Dynamically add search conditions before you call a Model.find

Repositorysvn://rails.bleedingtrends.com/dyna_con Author Michael Behan Tags Search LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install svn://rails.bleedingtrends.com/dyna_con

The usage is simple:

MyModel.add_conditions("username LIKE ? ", "%something%")



Each consecutive call to MyModel.add_conditions will append those conditions to MyModel.dynamic_conditions array

You may then use these conditions in a find via:

MyModel.find(:all, :conditions => MyModel.dynamic_conditions)



NOTE: In production mode, you MUST call MyModel.clear_conditions before appending conditions, because of model caching.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: Guest, 7 months ago