William Fisk wrote in post #977984:
> I am reading through some code in active_record/relation/query_methods -
> def
> build_where (about line 230); and there are a couple of calls to send.
>  Here's the first one
> [@klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))]
>
> and here's the second one
> attributes = @klass.send(:expand_hash_conditions_for_aggregates, opts)
>
> Why do we use send here when we could just call the method directly?
> I mean, why is the first call not just
> [@klass.sanitize_sql( other.empty? ? opts : ([opts] + other))]
>
> Puzzled.

The only reason I could see to do this would be to get around an access 
prohibition.  You can use send in this way to call a private or 
protected method.

>
> William

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to