This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 9ba34c820d8e36d788cb6e942d737ba461109dfa
tree 64089231137a9a1fd366c0be5af7eda1a7826d09
parent 038365401b96e42a72f98d083aa8100e7fd278fb
tree 64089231137a9a1fd366c0be5af7eda1a7826d09
parent 038365401b96e42a72f98d083aa8100e7fd278fb
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Tue Nov 27 08:54:40 -0800 2007 | [ambethia] |
| |
README | Tue Nov 27 08:54:40 -0800 2007 | [ambethia] |
| |
Rakefile | Tue Nov 27 08:54:40 -0800 2007 | [ambethia] |
| |
init.rb | Tue Nov 27 08:54:40 -0800 2007 | [ambethia] |
| |
lib/ | Tue Nov 27 08:54:40 -0800 2007 | [ambethia] |
| |
tasks/ | Tue Nov 27 08:54:40 -0800 2007 | [ambethia] |
| |
test/ | Tue Nov 27 08:54:40 -0800 2007 | [ambethia] |
README
= HasManyExclusiveConditions Author:: Jason L Perry (http://ambethia.com, http://paint.itred.org) Copyright:: Copyright (c) 2007 Jason L Perry License:: MIT URI:: http://subvert.itred.org/has_many_exclusive_conditions == Description This plugin adds an :exclusive_conditions option to ActiveRecord's has_many association. This let's you express ideas that are otherwise impossible with the default rails generated sql. === Caveat Emptor! You need to becareful with how rails interpolates your string to create the generated SQL. If you plan on using instance variables or methods in the fragment, be sure to use an UNinterpolated ruby string (ie, %q or single quotes). Also, be aware of boolean values and other things that are not always database agnostic. ActiveRecord methods like +quote_value+ can be your friend. == Example In this example, we want to create an association for a User's record, or if that user is an admin, all records will be included. User.has_many :accessible_records, :exclusive_conditions => %q(records.user_id = #{id} OR #{is_admin}) Will generate SQL like: SELECT * FROM things WHERE (`things`.user_id = 1 OR true) Instead of the SQL from regular +:condition+ option: SELECT * FROM things WHERE (`things`.user_id = 1) AND (`things`.user_id = 1 OR true)




