Model still using mysql

When calling a Result.find_by_content on my model, I get the following
error:

Mysql::Error: Table ‘db.results’ doesn’t exist: SHOW FIELDS FROM results

Yes, I remembered to put acts_as_ferret. Any ideas?

Trace:
/Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in
log' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:185:inexecute’
/Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:293:in
columns' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:incolumns’
/Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:213:in
column_for' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:135:incalculate’
/Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:64:in
count' #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:249:inrebuild_index’

Ah yes, I failed to read that it updates ActiveRecord also.

How do I turn ActiveRecord off?

Hi!

On Thu, Aug 03, 2006 at 01:54:57AM +0200, Winton wrote:

Ah yes, I failed to read that it updates ActiveRecord also.

How do I turn ActiveRecord off?

if you don’t want to use activerecord, acts_as_ferret won’t be of much
use to you. aaf is all about synchronizing some AR model with a ferret
index. That is, it’s tied to database create/update operations and will
update the ferret index according to the changes made to the database.

If your model isn’t backed by a database, you should go and use Ferret
directly - just as described at
http://ferret.davebalmain.com/api/files/TUTORIAL.html

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

On Wed, Aug 02, 2006 at 11:14:41AM +0200, Winton wrote:

When calling a Result.find_by_content on my model, I get the following
error:

Mysql::Error: Table ‘db.results’ doesn’t exist: SHOW FIELDS FROM results

Yes, I remembered to put acts_as_ferret. Any ideas?

in fact, acts_as_ferret depends on your model being an
ActiveRecord::Base child class represented by a database table.

For example, it may need to look up what fields your model has.

Besides that, in your case the index doesn’t seem to exist, so aaf tries
to build one from the Result records in the database - which fails.

Jens

`columns’
Posted via http://www.ruby-forum.com/.


Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

Hi Winton,

that’s right. find_by_content finds a ferret document. From that
document
the mysql-id gets extracted and then ActiveRecord gets the model from
the
db. Using ferret fulltext-searches are a magnitude faster than searching
on
an innodb with LIKE if there are many records on your db and you’ll get
the
ferret query language for your convenience.

If you don’t want to rely on the db at all you need to work with the
ferret
documents directly. That’s possible as well.

Cheers,
Jan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs