# Problem with scope\_out and acts\_as\_ferret

**URL:** <https://www.ruby-forum.com/t/problem-with-scope-out-and-acts-as-ferret/128142>\
**Category:** Ferret\
**Created:** [February 5, 2008, 11:19am UTC](https://www.ruby-forum.com/t/problem-with-scope-out-and-acts-as-ferret/128142 "2008-02-05T11:19:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tradem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tradem](https://www.ruby-forum.com/u/tradem)\
**Post date:** [February 5, 2008, 11:19am UTC](https://www.ruby-forum.com/t/problem-with-scope-out-and-acts-as-ferret/128142/1 "2008-02-05T11:19:07Z")

</div>

Hi!

We have a problem when using scope\_out plugin and acts\_as\_ferret in  
Rails 2.0.

When we’re using both plugins we get an error when trying to rebuild  
index or starting the server

(druby://localhost:9010)  
/vendor/plugins/scope\_out/lib/scope\_out.rb:70:in `method_missing': undefined method`aaf\_configuration’ for #Class:0x251b3bc  
(NoMethodError)  
from (druby://localhost:9010)  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/base.rb:1532:in  
`method_missing' from (druby://localhost:9010) /vendor/plugins/acts_as_ferret/lib/ferret_server.rb:120:in`ensure\_index\_exists’  
from (druby://localhost:9010)  
/vendor/plugins/acts\_as\_ferret/lib/ferret\_server.rb:164:in `with_class' from (druby://localhost:9010) /vendor/plugins/acts_as_ferret/lib/ferret_server.rb:119:in`ensure\_index\_exists’  
from /vendor/plugins/acts\_as\_ferret/lib/remote\_index.rb:16:in  
`send' from /vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:in`method\_missing’  
from /vendor/plugins/acts\_as\_ferret/lib/act\_methods.rb:189:in  
`acts\_as\_ferret’  
from /app/models/post.rb:17  
… 60 levels…

Did anybody have the same problems and did already solve this?

Tobi

---

<div class="post-metadata">

**Author:** ![tradem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tradem](https://www.ruby-forum.com/u/tradem)\
**Post date:** [May 17, 2008, 7:09am UTC](https://www.ruby-forum.com/t/problem-with-scope-out-and-acts-as-ferret/128142/2 "2008-05-17T07:09:21Z")

</div>

I am having the same problem now, with our production rails (1.2.6)  
server, however, I am not using the scope\_out plugin.

My plugins: acts\_as\_ferret broomstick comatose exception\_notification  
recaptcha restful\_authentication routing\_tricks rspec rspec\_autotest  
rspec\_on\_rails spawn

I get the following error when trying to start a rails instance or a  
console with my acts\_as\_ferret line in my model.

(druby://localhost:9010)  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active\_record/base.rb:1238:in  
`method_missing':NoMethodError: undefined method`aaf\_configuration’ for  
Article:Class

At first I thought it was an index problem but this seems like something  
is getting loaded in the wrong order. Our environment was pretty stable  
and our plugins haven’t changed at all so I’m having a hard time trying  
to track down the problem.

Here’s my ferret hook in my class:  
STOP\_WORDS = []  
acts\_as\_ferret(  
{ :fields =\> {:title\_text =\>{:store=\>:yes},:authors\_text  
=\>{:store=\>:yes}, :volume =\>{:store=\>:yes}, :year =\>{:store=\>:yes},  
:fpage =\>{:store=\>:yes}, :abstract\_text=\>{:store=\>:yes},:article\_text =\>  
{:store=\>:yes}, :issue =\> {:store=\>:yes}, :pub\_date\_sort =\> {:index =\>  
:untokenized}}},  
{:analyzer =\> Ferret::Analysis::StandardAnalyzer.new(STOP\_WORDS)})

Were you able to find a solution? Did you have to remove that plugin?

Shawn

Tobias Reike wrote:

> Hi!
> 
> We have a problem when using scope\_out plugin and acts\_as\_ferret in  
> Rails 2.0.
> 
> When we’re using both plugins we get an error when trying to rebuild  
> index or starting the server
> 
> (druby://localhost:9010)  
> /vendor/plugins/scope\_out/lib/scope\_out.rb:70:in `method_missing': undefined method`aaf\_configuration’ for #Class:0x251b3bc  
> (NoMethodError)  
> from (druby://localhost:9010)  
> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/base.rb:1532:in  
> `method_missing' from (druby://localhost:9010) /vendor/plugins/acts_as_ferret/lib/ferret_server.rb:120:in`ensure\_index\_exists’  
> from (druby://localhost:9010)  
> /vendor/plugins/acts\_as\_ferret/lib/ferret\_server.rb:164:in `with_class' from (druby://localhost:9010) /vendor/plugins/acts_as_ferret/lib/ferret_server.rb:119:in`ensure\_index\_exists’  
> from /vendor/plugins/acts\_as\_ferret/lib/remote\_index.rb:16:in  
> `send' from /vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:in`method\_missing’  
> from /vendor/plugins/acts\_as\_ferret/lib/act\_methods.rb:189:in  
> `acts\_as\_ferret’  
> from /app/models/post.rb:17  
> … 60 levels…
> 
> Did anybody have the same problems and did already solve this?
> 
> Tobi

---

<div class="post-metadata">

**Author:** ![tradem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tradem](https://www.ruby-forum.com/u/tradem)\
**Post date:** [May 19, 2008, 8:49pm UTC](https://www.ruby-forum.com/t/problem-with-scope-out-and-acts-as-ferret/128142/3 "2008-05-19T20:49:49Z")

</div>

Looks like this is more user error than anything. After scratching my  
head for about 4 days, I found that the ferret server needs to know  
which models are tied to it through the acts\_as\_ferret declaration,  
which is done by specifying the root (-R) parameter.

The script/ferret\_server must be started with the environment and the  
root parameters. The root parameter (-R) serves 2 purposes. One, it  
tells ferret where the index files reside (RAILS\_ROOT/index) and where  
the models are (RAILS\_ROOT/app/models). Apparently, ferret needs access  
to the models. I found this out when I started a console instance from a  
different project checked out where the acts\_as\_ferret line in my model  
was active and the ferret server was started in a different directory  
where the acts\_as\_ferret line was commented out. The console returned  
this error:  
(druby://localhost:9010)  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active\_record/base.rb:1238:in  
`method_missing':NoMethodError: undefined method`aaf\_configuration’ for Article:Class

```
Secondly, if the root parameter is absent, it will look to the 

```

current directory and try to build the indexes there.

```
To sum this up, the ferret server depends on the rails project and 

```

index files; the rails project depends on a started ferret server (when  
acts\_as\_ferret is used). Multiple instances of rails accessing the same  
ferret server should have the exact same models with the same  
acts\_as\_ferret hooks.

This probably a bit obvious but I felt obliged to post for those  
less-obvious types like myself. 😉

Shawn
