Search code examples
ruby-on-railsscriptaculous

Rails Autocomplete: function not found


i jave the following code

<% javascript_tag do %>
    new Ajax.Autocompleter('issue_autocomplete',
       'issue_candidates',
       '<%= url_for :controller => 'requirements', :action => 'autocomplete_issues' %>',
       { minChars: 1,
         frequency: 0.5,
         afterUpdateElement : function(text, li) { $('issue_id').setValue(li.id) }
         });
  <% end %>

and in my requirements_controller.rb file there is a autocomplete_issues function.

yet, when i type in some text into the textfield, it says 404 the function couldnt be found. i dont think it has to do something with the routes, because at another place in the code theres a autocompleteter calling a different function but using similar routes.

url: http://localhost:3000/requirements/autocomplete_issues

stacktrace:

Processing RequirementsController#autocomplete_issues (for 127.0.0.1 at 2011-07-09 13:15:23) [POST] Parameters: {"sink_name"=>"sd", "action"=>"autocomplete_issues", "controller"=>"requirements"} ←[4;36;1mSQL (0.0ms)←[0m ←[0;1mSELECT max("settings".updated_on) AS max_updated_on FROM "settings" ←[0m ←[4;35;1mUser Load (0.0ms)←[0m ←[0mSELECT * FROM "users" WHERE ("users"."id" = 1) AND (users.status = 1) AND ( ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) ) ←[0m Filter chain halted as [:find_project] rendered_or_redirected. Completed in 2156ms (View: 219, DB: 0) | 404 Not Found [http://localhost/requirements/autocomplete_issues] ssues]

routes are regular map.resources without anything fancy

anyone has an idea where I could look?


Solution

  • The line that jumps out to me is:

    Filter chain halted as [:find_project] rendered_or_redirected
    

    You probably have a before_filter that is requiring either :post , or an authenticated user, or some other precondition