Auto_complete plugin in Rails 2.2.2 (auto_complete_for method not found)

Hello world,
I am considering myself to be a newbie in Ruby, but not programming in
general and i have a very serious problem trying to get Rails 2.2.2 to
install the auto_complete plugin in Windows XP. I always get the
“auto_complete_for method not found” error in ruby.

After 2 days of full-internet-search I have tried the following:

  • Using the “ruby script/plugin install auto_complete” command :
    results in “not found” (even after adding every single repository
    under discovery)

  • Trying to load the SVN URL posted in oh-so-many forums, in the “ruby
    on rails” official site, I get a “page not found” error

  • Trying to manually copy the files in the vendor/plugin directory of
    my project (got them from the model_auto_completer example), but still
    does not work… (if i execute “script/plugin list” there is nothing)

Regarding this last part, i have been trying to find documentation
about how to manually install a plugin, but with no results. In every
forum that someone asks “how to do it manually” people respond with
“script/plugin install”. This is automatic, not manually, as i am sure
most of you know. What i am searching for is instructions on: where to
place the files myself and what to execute myself so that my project
will ‘use’ the plugin.

I will be thankful for any help you might offer, no matter how small,
but PLEASE don’t repeat to me steps i have already taken with no
differentation what-so-ever. This is both pointless and insulting.

Yours sincerely,
a frustrated RoR programmer
Spiros K.

On 13 Feb 2009, at 09:19, Spiros K. wrote:

most of you know. What i am searching for is instructions on: where to
place the files myself and what to execute myself so that my project
will ‘use’ the plugin.

Copying the files into vendor/plugins is all there is to it 99% of the
time. Some plugins have an install.rb file that needs to be run after
this.
Don’t worry about the output of script/plugin list (which as far as I
can tell is for listing available, not installed plugins)

The autocomplete plugin is on github these days:

Newer versions of rails include a version of script/plugin that can
install plugins from git repositories (assuming you have git itself of
course).

Fred

Thanks for your reply,
but

  1. this specific plugin did not have an install.rb with it.
  2. 2.2.2 is as new as they get I just downloaded 3 weels ago…?! And
    i think it works just fine with git as I have downloaded from git as
    well (though it messed my tortoise svn structure pretty badly)

Then fired up my script/server and still:

“method not found” for autocomplete_for method!!! :frowning:

On Feb 13, 12:55 pm, Frederick C. [email protected]

Yes, the plugin IS in vendor plugins and YES you can check my first
post in the thread and see that my 2nd post was actually a typo in my
behalf. The problem remains as stated.

BTW, the code was copy-pasted from tutorials that supposedly work, so
I doubt there is any weird typo in the actual code.

On Feb 14, 12:41 pm, Frederick C. [email protected]

On Feb 14, 3:52 pm, “Spiros K.” [email protected] wrote:

Yes, the plugin IS in vendor plugins and YES you can check my first
post in the thread and see that my 2nd post was actually a typo in my
behalf. The problem remains as stated.

odd. i’d stick a breakpoint in the plugin’s init.rb to see what was
happening there (you should have vendor/plugins/auto_complete/init.rb
and vendor/plugins/auto_complete/lib ) If you have changed
config.plugins or config.plugin_paths in environment.rb that could
cause this (but I rather suspect you’d remember if you’d done that).

BTW, the code was copy-pasted from tutorials that supposedly work, so
I doubt there is any weird typo in the actual code.

I wouldn’t be so sure :slight_smile:

Fred

On Feb 14, 9:58 am, “Spiros K.” [email protected] wrote:

Thanks for your reply,
but

  1. this specific plugin did not have an install.rb with it.
  2. 2.2.2 is as new as they get I just downloaded 3 weels ago…?! And
    i think it works just fine with git as I have downloaded from git as
    well (though it messed my tortoise svn structure pretty badly)

so is the plugin in vendor/plugins ?

Then fired up my script/server and still:

“method not found” for autocomplete_for method!!! :frowning:

I also assume that that was a typo and you actually write
auto_complete_for in your controller.

Fred

I checked today and everything is in order (that is commented out as
is the default).
Do you mean i should have added 1 or more lines to the
“environment.rb” file??

Anyway, so for the sake of completeness, here is my code!

#models#
#----------#

#book model
has_many :book_authorities, :dependent => :delete_all
has_many :authorities, :through => :book_authorities

#authority_model
has_many :book_authorities, :dependent => :delete_all
has_many :books, :through => :book_authorities

#book_authority model
belongs_to :book
belongs_to :authority
auto_complete_for :authority, :surname

#view#
#------#

<% fields_for "book[book_authority_attributes][]", book_authority, :index => nil do |bookauthority_form| %> authority: <%= bookauthority_form.select(:authority_id, $allnames) %>
capacity: <%= bookauthority_form.text_field :capacity, :index => nil %>
<% if book_authority.new_record? %> <%= link_to_function "remove", "$(this).up ('.book_authority').remove()" %> <% else %> <%= link_to_function "remove", "mark_for_destroy_ba(this)" %> <%= bookauthority_form.hidden_field :id %> <%= bookauthority_form.hidden_field :should_destroy, :index => nil, :class => 'should_destroy' %> <% end %> <% end %>

#controllers#
#---------------#

#application_controller

def update_authorities
#@allauthorities = Authority.find(:all, :limit => 5000, :order =>
“id ASC”)
@allauthorities = Authority.find(:all)
$allnames = Hash.new()
for a in @allauthorities
$allnames.merge!({ ((a.surname || “”) + " " + (a.name || “”) +
“,” + (a.short_title || “”)) => a.id})
end
end

On Feb 14, 6:55 pm, Frederick C. [email protected]