Problem with new action

I’m having issues submitting a form to the create action.

In routes I have

map.resources :encryption_passphrases

This resource is not using an ActiveRecord model, so I can’t use the
form_for method in the view.

In app/views/encryption_passphrases/new.html.erb I have this:

<% form_tag(encryption_passphrases_url, :method => “post”) do |f| %>

<%= password_field_tag :encryption_passphrase %>

<%= submit_tag "Create" %>

<% end %>

This results in the following html:

When I hit the Create button, I get this error on the resulting page:

“Unknown action
No action responded to index”

I don’t know why it’s going to the get http method because it says
post in the form tag.

Can anybody tell me how to fix this?

Thanks,

Jonathan

Try running “rake routes” to see if the URL you get is recognized as a
resource url. Maybe the :controller/:action/:id route outranks your
resources route. The resources route should be specified higher up in
the file.

Christina,

Thanks for the response.

This is what my rake routes command outputs. The
encryption_passphrases resource is at the top of everything in the
application. The :controller/:action/:id route is at the very bottom.

          encryption_passphrases GET    /

encryption_passphrases
{:controller=>“encryption_passphrases”, :action=>“index”}
formatted_encryption_passphrases GET /
encryption_passphrases.:format
{:controller=>“encryption_passphrases”, :action=>“index”}
POST /
encryption_passphrases
{:controller=>“encryption_passphrases”, :action=>“create”}
POST /
encryption_passphrases.:format
{:controller=>“encryption_passphrases”, :action=>“create”}
new_encryption_passphrase GET /encryption_passphrases/
new
{:controller=>“encryption_passphrases”, :action=>“new”}
formatted_new_encryption_passphrase GET /encryption_passphrases/
new.:format
{:controller=>“encryption_passphrases”, :action=>“new”}
edit_encryption_passphrase GET /
encryption_passphrases/:id/edit
{:controller=>“encryption_passphrases”, :action=>“edit”}
formatted_edit_encryption_passphrase GET /
encryption_passphrases/:id/edit.:format
{:controller=>“encryption_passphrases”, :action=>“edit”}
encryption_passphrase GET /
encryption_passphrases/:id
{:controller=>“encryption_passphrases”, :action=>“show”}
formatted_encryption_passphrase GET /
encryption_passphrases/:id.:format
{:controller=>“encryption_passphrases”, :action=>“show”}
PUT /
encryption_passphrases/:id
{:controller=>“encryption_passphrases”, :action=>“update”}
PUT /
encryption_passphrases/:id.:format
{:controller=>“encryption_passphrases”, :action=>“update”}
DELETE /
encryption_passphrases/:id
{:controller=>“encryption_passphrases”, :action=>“destroy”}
DELETE /
encryption_passphrases/:id.:format
{:controller=>“encryption_passphrases”, :action=>“destroy”}
.
.
. {other controllers}
.
/:controller/:action/:id
/:controller/:action/:id.:format

I’ve worked around the issue by causing the index action to call the
create method, but I’d rather have it work as designed…

Any other suggestions?

Thanks,
Jonathan