# Controller action code not being executed

**URL:** <https://www.ruby-forum.com/t/controller-action-code-not-being-executed/187095>\
**Category:** Rails\
**Created:** [April 16, 2010, 8:10pm UTC](https://www.ruby-forum.com/t/controller-action-code-not-being-executed/187095 "2010-04-16T20:10:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lpeabody](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/77aa72/32.png) [@lpeabody](https://www.ruby-forum.com/u/lpeabody)\
**Post date:** [April 16, 2010, 8:10pm UTC](https://www.ruby-forum.com/t/controller-action-code-not-being-executed/187095/1 "2010-04-16T20:10:25Z")

</div>

Hi all! I have a similar post going on at [railsforum.com](http://railsforum.com), but I figured  
getting help from multiple sources is better than just one! Let me  
begin.

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

* * *

## def permit raise Exception end

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.id,  
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 132.177.103.226 at 2010-04-16  
18:03:54) [PUT]  
Parameters: {“commit”=\>“Submit”, “comment\_ids”=\>[“11”],  
“authenticity\_token”=\>“kAhSpFrm06GqNK80UDyjjFengWns+s6SO0jGaqJO5v0=”}

## ActionController::UnknownAction (No action responded to permit. Actions: create, current\_user, current\_user\_session, destroy, index, and record\_not\_found): 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) lib/phusion\_passenger/railz/application\_spawner.rb:385:in `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) lib/phusion\_passenger/abstract\_server\_collection.rb:126:in `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.

Cheers,  
Les

---

<div class="post-metadata">

**Author:** ![lpeabody](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/77aa72/32.png) [@lpeabody](https://www.ruby-forum.com/u/lpeabody)\
**Post date:** [April 16, 2010, 8:55pm UTC](https://www.ruby-forum.com/t/controller-action-code-not-being-executed/187095/2 "2010-04-16T20:55:56Z")

</div>

Is that not a get request?

---

<div class="post-metadata">

**Author:** ![lpeabody](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/77aa72/32.png) [@lpeabody](https://www.ruby-forum.com/u/lpeabody)\
**Post date:** [April 16, 2010, 9:26pm UTC](https://www.ruby-forum.com/t/controller-action-code-not-being-executed/187095/3 "2010-04-16T21:26:03Z")

</div>

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
