自分メモ


環境:

ruby1.9.2(P180)
rails3.0.7
Windows 7


auto_ompleteプラグインをインストールしようとして以下コマンドを実施

$ rails plugin install git://github.com/rails/auto_complete.git

エラー発生。
c:/Tools/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/commands/plugin.rb:277:in `': Commands is not a module (TypeError)


なんじゃそりゃ。
plugin.rbでエラーだと?とりあえずggrとこんなのを見つけた。

https://github.com/rails/rails/issues/1866

結局原因はよくわからないが、「Commands」の名前ががどっかとかぶってるっぽい。
ので、@dybaの言うとおり下記のように書き換え

277:module Commands
  ↓
277:module RailsCommands

335:command = Commands.const_get(command.capitalize).new(self)
  ↓
335:command = RailsCommands.const_get(command.capitalize).new(self)

547:Commands::Plugin.parse!
  ↓
547:RailsCommands::Plugin.parse!


これで再度実行。

$ rails plugin install git://github.com/rails/auto_complete.git
Initialized empty Git repository in C:/Users/domyo/workspace/ajaxtest/vendor/plugins/auto_complete/.git/
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 13 (delta 2), reused 6 (delta 1)
Unpacking objects: 100% (13/13), done.
From git://github.com/rails/auto_complete
* branch HEAD -> FETCH_HEAD

はいったっぽい。



しかし、入ったはいいけど動かないという事態。
Rails3では動かないのか?エラーは出ないんだけど。そもそもリクエストがpostされない感じ。
オートコンプリートはこれ使えって言われたけど、使えないんだがどうすればいいんだ。
jqueryのautocompleteでも使ってみるか。