Difference between _path and :action => 'some_method'

Hello. So solved some error with just replacing path method with calling
:action=>…
But I’m curious why in absolutely same in first case _path worked
perfect,
in second it causer an error which is solved just by changing syntax
(but
not the sence of what is happening)
First case:

<%= form_for @answer, {:url => create_answer_test_path(@test), :html =>
{:id=>“form_#{@key.position}”}, :remote=>true}

worked with no problem

<%= button_to ‘-’, {:url=>delete_answer_test_path(@test)},
:method=>:delete, :remote =>true %>

Caused several types of errors:

ActionController::RoutingError (No route matches
{:action=>“delete_answer”,
:controller=>“tests”, :id=>nil})

Started DELETE
“/tests/150/create_answer?key_id=905&url=%2Ftests%2F150%2Fdelete_answer”
for 127.0.0.1 at 2013-03-18 12:08:36 +0400 (??? for some reason started
previous method and ‘delete_answer’ was just in server call)

But when I replaced it with {:controller=>‘tests’, :action =>
‘delete_answer’} (which is basically just another way of syntax, but not
of
what is going on) works fine.

?

On Monday, March 18, 2013 8:33:15 AM UTC, Barry wrote:

You haven’t said what the route is, but it would appear that you’ve made
it
a member route of a collection: this is an action that does something
with
a specific instance of your Test class. What this error is saying is
that @test is apparently unsaved so doesn’t have an id, which doesn’t
make
any sense to rails (although of course it doesn’t know if you then use
the
id parameter or not)

Fred