[Rails] [ANN] Where Plugin
Ezra Zygmuntowicz
ezra at yakimaherald.com
Sun Jan 1 23:48:24 GMT 2006
On Jan 1, 2006, at 2:56 PM, Jens-Christian Fischer wrote:
>> When I was originally playing with this I came up with this little
>> class : http://rubyurl.com/DxL
>>
>> With that one you can build the conditions with a lightly nicer
>> syntax:
>>
>> c = Cond.new do
>> month '<=', 11
>> year '=', 2005
>> name 'LIKE', 'ruby%'
>> end
>
> Ahh - I didn't realize you already had that class fleshed out. I'm
> fairly new to methods taking blocks, so I didn't know how to use
> your syntax (which I like) with the
>
> Model.find_with_conditions ....
>
> method. The "method_missing" won't work, because it would override
> ActiveRecords method_missing, right?
>
> How to integrate those two concepts?
>
> jc
>
> --
> InVisible GmbH, Langgrütstrasse 172, 8047 Zürich
> Phone: +41 44 401 09 30
> http://www.invisible.ch http://not.invisible.ch
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
I will have to take a look at how you implemented the
find_with_conditions and get back to you. It should be possible
though. There might be something that could be done with calling
super in the method_missing to make sure we don't entirely override
AR's method_missing. Or maybe the best way would be to keep the
method_missing confined in the Cond class and yield a new Cond object
when find_with_conditions gets called.
I will take a peek and get back to you with a patch.
Cheers-
-Ezra Zygmuntowicz
WebMaster
Yakima Herald-Republic Newspaper
ezra at yakima-herald.com
509-577-7732
More information about the Rails
mailing list