Forum: Ferret Using acts_as_ferret outside rails

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.
C74520b132df7934bcd60d22998d3628?d=identicon&s=25 Pedro =?ISO-8859-1?Q?C=F4rte-Real?= (Guest)
on 2006-06-01 17:11
(Received via mailing list)
How do I use a model that has "acts_as_ferret" defined outside rails?
I've tried adding this to the top of my model:

require
"#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb"

and then defining RAILS_ROOT and RAILS_ENV in my app that uses the model
outside rails. That got me this exception:

../vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:465:in
`ferret_create': undefined method `debug' for nil:NilClass
(NoMethodError)

Anyone know what's the correct way to do this?

Thanks,

Pedro.
C74520b132df7934bcd60d22998d3628?d=identicon&s=25 Pedro =?ISO-8859-1?Q?C=F4rte-Real?= (Guest)
on 2006-06-01 18:02
(Received via mailing list)
On Thu, 2006-06-01 at 16:09 +0100, Pedro Côrte-Real wrote:
> `ferret_create': undefined method `debug' for nil:NilClass
> (NoMethodError)
>
> Anyone know what's the correct way to do this?

I found a way to do it. At the start of my script:

require File.dirname(__FILE__) + '/../config/boot'
ENV["RAILS_ENV"] = 'development'
require RAILS_ROOT + '/config/environment'

After that I can use every model as if I was inside rails. I copied most
of this from the code for script/runner.

Cheers,

Pedro.
This topic is locked and can not be replied to.