ActionController::MethodNotAllowed Only get, put, and delete requests are allowed

Hi.
I have seen the same problem in this forum, but the solution isn’t
work in my case.I’m developing with Netbeans 6.9.1 with SO Windows
Vista. I’m using Rails 2.3.8 and Mogrel 1.1.5.

Part in the code of routes.rb is:

ActionController::Routing::Routes.draw do |map|
map.desactivateapis ‘apis/
desactivateapis’, :controller=>‘apis’, :action=>‘desactivateapis’

The file apis_controller.rb contains:

class ApisController < ApplicationController
def desactivateapis
@apis = params[:putinactive]
if @apis
for a in @apis
@api = Api.find(a)
@api.isactive=false
@api.save
end
end
end
end

And finally the view file desactiveapis.rb is:

<%= error_messages_for :api %>
<% form_tag(@api) do |f| %>
<%= t(“start.users.introdesactivateapis”)%>

<% cont=0%>
<%Api.find(:all).each do|a| %>
<%if a.isactive==true %>
<% cont=cont+1%>
<%= check_box_tag ‘putinactive[]’, a.id %>
<%=a.name%>

<%end%>
<%end %>
<%if cont==0%>
<%=t(“start.users.noactiveapis”)%>

<%end %>
<%= submit_tag t(“start.users.select”), :confirm =>
t(“start.users.sure”) %>
<%end%>

The full trace of the error is:

C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/actionpack-2.3.8/lib/action_controller/routing/
recognition_optimisation.rb:64:in recognize_path' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb: 442:inrecognize’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:
437:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:87:indispatch’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:121:in
_call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:130:inbuild_middleware_stack’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/
query_cache.rb:34:in cache' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/activerecord-2.3.8/lib/active_record/query_cache.rb:9:incache’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/activerecord-2.3.8/lib/active_record/query_cache.rb:28:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/ connection_pool.rb:361:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in
call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/rack-1.1.0/lib/rack/head.rb:9:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/actionpack-2.3.8/lib/action_controller/session/cookie_store.rb:
99:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/rack-1.1.0/lib/rack/lock.rb:11:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:114:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/actionpack-2.3.8/lib/action_controller/reloader.rb:34:in run' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:108:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/rails-2.3.8/lib/rails/rack/static.rb:31:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/rack-1.1.0/lib/rack/urlmap.rb:49:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/rack-1.1.0/lib/rack/urlmap.rb:41:in each' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/rack-1.1.0/lib/rack/urlmap.rb:41:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/rails-2.3.8/lib/rails/rack/log_tailer.rb:17:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/rack-1.1.0/lib/rack/content_length.rb:13:incall’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/rack-1.1.0/lib/rack/chunked.rb:15:in call' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:inprocess’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/mongrel-1.1.5-java/lib/mongrel.rb:159:in process_client' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/mongrel-1.1.5-java/lib/mongrel.rb:158:ineach’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in process_client' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/mongrel-1.1.5-java/lib/mongrel.rb:285:inrun’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in initialize' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/mongrel-1.1.5-java/lib/mongrel.rb:285:innew’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in run' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/mongrel-1.1.5-java/lib/mongrel.rb:268:ininitialize’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in new' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/mongrel-1.1.5-java/lib/mongrel.rb:268:inrun’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/
gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in run' C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/rails-2.3.8/lib/commands/server.rb:111 C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/ gems/rails-2.3.8/lib/commands/server.rb:31:inrequire’
C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/site_ruby/
1.8/rubygems/custom_require.rb:31:in `require’
script\server:3

I have a list of names with a check box, I select something and I
click in the submit, everythig is ok and it’s shown the same page
without the names previously selected. If now, I repeat the process:
select some check box and click in the submit, the explained error is
generated.

I haven’t been able to fix this error and I’ve searched in google for
some days.

Thank you.
Margo

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