Forum: Ruby on Rails getting proxy_options from named_scopes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
93b1c03b74dff7a41060d41a2da750ce?d=identicon&s=25 Jonatas Paganini (jonatas)
on 2009-03-19 14:47
Hi, I have been using named_scopes and works great!
but I need to get the sql conditions to send for my iReport =)

when I do

User.valid.proxy_options returns ok

but

User.valid.created_by('jonatas').proxy_options

returns just proxy_options from last named scope

if I put:

(User.valid.created_by('jonatas')).proxy_options

also returns just proxy_options from last named scope


so, how can I get proxy_options from nested named_scope's?

how can I get sanitize sql for nested named_scope's?

thx's
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-03-19 15:14
(Received via mailing list)
On Mar 19, 1:47 pm, Jonatas Paganini <rails-mailing-l...@andreas-
s.net> wrote:
>
> returns just proxy_options from last named scope
>
> if I put:
>
> (User.valid.created_by('jonatas')).proxy_options
>
> also returns just proxy_options from last named scope

Well in general in an activerecord method scope(:find) returns the
current scope for find operations, and it's no different here:
User.valid.created_by('jonatas')).scope(:find)

Fred
93b1c03b74dff7a41060d41a2da750ce?d=identicon&s=25 Jonatas Paganini (jonatas)
on 2009-03-19 20:02
Thanks very much man!

Works rigth now!
This topic is locked and can not be replied to.