acts_as_ferret 求助
当前位置:首页 ----> Web开发 ----> Ruby/Python
关键词:acts as ferret,ror,mysql,config environment rb,ferret,model,mytest,text,column,content,model mytest rb,as ferret,nil
loyogo:
相关文章: X    ror 连接 mysql5.0 问题  ROR新手请问连mysql数据库的问题.  no such file to load -- openssl (RuntimeError)    <img src=http://www.javaeye.com/images/icon_more.gif/>          Acts_as_ferret 始终返回为空 环境如下: - gem install ferret - gem install acts_as_ferret - 创建一个空项目 - 在config/environment.rb中添加下边一行  require 'acts_as_ferret' - 创建一个model,名为mytest,并增加一个:text类型的column 名为 content - 在app/model/mytest.rb 中添加下边一行  acts_as_ferret - 在表中添加一些数据项 通过ruby script/console   Mytest.find_by_content("xxx")  nil 一直都是返回nil 有那位仁兄知道问题出在哪呢,感谢。


loyogo:
oh,sorry,是我写错了,应当是 Mytest.find_by_contents("xxx") 但是依旧没有找到任何结果 日志中有这么一段 Asked for a remote server ? nil, ENV["FERRET_USE_LOCAL_INDEX"] is "1", looks like we are the server Will use local index. using index in ./script/../config/../index/development/mytest


Readonly:
别直接往数据库写,用ActiveRecord的create方法去创建


loyogo:
Readonly 写道别直接往数据库写,用ActiveRecord的create方法去创建 我是用scaffold创建的,图个方便,过程里没写那一段。


Readonly:
model上指定fields了吗?


loyogo:
Readonly 写道model上指定fields了吗? 没有指定,那应当是表示全部吧?


libiun:
这还好,我把acts放进了vendor/plugins后,mongrel怎样也启动不了。
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:15: warning: already initialized constant OPTIONS
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:18: undefined method `options' for []:Array (NoMethodError)
 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
 from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
 from script/server:3
Exiting
把插件删了就好了。晕死了
原文出处:http://www.javaeye.com/topic/110527