# Accessing scopes

**URL:** <https://www.ruby-forum.com/t/accessing-scopes/76795>\
**Category:** Rails\
**Created:** [November 21, 2006, 6:19am UTC](https://www.ruby-forum.com/t/accessing-scopes/76795 "2006-11-21T06:19:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_Firth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5e9695/32.png) [@Bob\_Firth](https://www.ruby-forum.com/u/Bob_Firth)\
**Post date:** [November 21, 2006, 6:19am UTC](https://www.ruby-forum.com/t/accessing-scopes/76795/1 "2006-11-21T06:19:30Z")

</div>

If with\_scope has been called previously, how do I access the find  
conditions dynamically?

I am asking because I am using a find\_by\_sql call (which clobbers the  
with\_scope). How can I access the method scoping so that I can read it  
and incorporate it into my query manually?

---

<div class="post-metadata">

**Author:** ![Bob\_Firth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5e9695/32.png) [@Bob\_Firth](https://www.ruby-forum.com/u/Bob_Firth)\
**Post date:** [April 2, 2007, 11:14pm UTC](https://www.ruby-forum.com/t/accessing-scopes/76795/2 "2007-04-02T23:14:38Z")

</div>

Bob Firth wrote:

> If with\_scope has been called previously, how do I access the find  
> conditions dynamically?
> 
> I am asking because I am using a find\_by\_sql call (which clobbers the  
> with\_scope). How can I access the method scoping so that I can read it  
> and incorporate it into my query manually?

any answers to this. I’m finding myself in the same position. I’m  
using the will\_paginate plugin and I have a couple of find\_by\_sql calls  
that I’d love to somehow get at the limit and offset and just modify my  
sql to include those parameters…

---

<div class="post-metadata">

**Author:** ![Bob\_Firth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5e9695/32.png) [@Bob\_Firth](https://www.ruby-forum.com/u/Bob_Firth)\
**Post date:** [April 3, 2007, 12:49am UTC](https://www.ruby-forum.com/t/accessing-scopes/76795/3 "2007-04-03T00:49:37Z")

</div>

El Gato wrote:

> Bob Firth wrote:
> 
> > If with\_scope has been called previously, how do I access the find  
> > conditions dynamically?
> > 
> > I am asking because I am using a find\_by\_sql call (which clobbers the  
> > with\_scope). How can I access the method scoping so that I can read it  
> > and incorporate it into my query manually?
> 
> any answers to this. I’m finding myself in the same position. I’m  
> using the will\_paginate plugin and I have a couple of find\_by\_sql calls  
> that I’d love to somehow get at the limit and offset and just modify my  
> sql to include those parameters…

actually, it appears that scoped\_methods contains the hash of scoped  
options.
