Controller action code not being executed

Hi all! I have a similar post going on at, but I figured
getting help from multiple sources is better than just one! Let me

I have a controller, CommentsController, with a custom action ‘permit’
defined as follows:

def permit
raise Exception

I have a route:

map.resources :comments, :collection => { :permit => :put }

And I have a form:

<% stylesheet(“comments”) %>
<% form_tag permit_comments_path, :method => :put do %>
<% for comment in @comments %>
<%= check_box_tag “comment_ids[]”,,
comment.display_comment %>
<%= render :partial => “comment”, :object => comment %>
<% end %>
<%= submit_tag “Submit” %>
<% end %>

<%= will_paginate @comments %>


Note that I have followed Railscasts episode 52 verbatim.

The problem I’m running into is you check off a couple of checkboxes in
that form and click submit and you get the following page:

Unknown action
No action responded to permit. Actions: create, current_user,
current_user_session, destroy, index, and record_not_found

What should happen is I should be prompted with an error page saying
Exception was raised in CommentsController#permit. The code in that
‘permit’ action method is simply not getting executed, and for the life
of me I don’t understand why. I’ll finish by posting the log message
for the form submission:

Processing CommentsController#permit (for at 2010-04-16
18:03:54) [PUT]
Parameters: {“commit”=>“Submit”, “comment_ids”=>[“11”],

ActionController::UnknownAction (No action responded to permit. Actions:
create, current_user, current_user_session, destroy, index, and
passenger (2.2.8) lib/phusion_passenger/rack/request_handler.rb:92:in
process_request' passenger (2.2.8) lib/phusion_passenger/abstract_request_handler.rb:207:in main_loop’
passenger (2.2.8)
start_request_handler' passenger (2.2.8) lib/phusion_passenger/railz/application_spawner.rb:343:in handle_spawn_application’
passenger (2.2.8) lib/phusion_passenger/utils.rb:184:in safe_fork' passenger (2.2.8) lib/phusion_passenger/railz/application_spawner.rb:341:in handle_spawn_application’
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:352:in
__send__' passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:352:in main_loop’
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:196:in
start_synchronously' passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:163:in start’
passenger (2.2.8)
lib/phusion_passenger/railz/application_spawner.rb:209:in start' passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:262:in spawn_rails_application’
passenger (2.2.8)
lookup_or_add' passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:256:in spawn_rails_application’
passenger (2.2.8)
lib/phusion_passenger/abstract_server_collection.rb:80:in synchronize' passenger (2.2.8) lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize’
passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:255:in
spawn_rails_application' passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:154:in spawn_application’
passenger (2.2.8) lib/phusion_passenger/spawn_manager.rb:287:in
handle_spawn_application' passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:352:in send
passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:352:in
main_loop' passenger (2.2.8) lib/phusion_passenger/abstract_server.rb:196:in start_synchronously’

Any kind of intuition, help, or advice that can be offered would be
greatly appreciated.


Is that not a get request?

Chris H. wrote:

Is that not a get request?

What indicates a get request? I’m telling it in every circumstance to
my knowledge that it’s a PUT request. Correct me if I’m wrong as I’m a
relatively new Rails programmer.

The following is straight out of ‘rake routes’

permit_comments PUT /comments/permit(.:format)
{:action=>“permit”, :controller=>“comments”}

The end goal here is to take what was passed in the comment_ids field in
the params hash and for each id in comment_ids mark its respective
comment’s display_comment field true.

  • Les