Okay, I’ve worked through the tutorial in 2nd ed. Agile Dev book.
And I think I understand the methods concerning user management;
however, when I use :method => :post in my app, I get a link of the
following variety:
<li><a href="/login/delete_user/2" method="post" onclick="return
confirm(‘Really delete john?’);">[X]
john
Note the ‘method=“post”’, and in my log when I click this thing, no
‘post’ goes through, and no user gets deleted.
My delete_user method is identical to book’s.
However, when I use :post => ‘true’, no problem; post shows up in log,
and user gets deleted.
Generated code looks like:
<li><a href="/login/delete_user/1" onclick="if (confirm('Really
delete john?’)) { var f = document.createElement(‘form’);
this.parentNode.appendChild(f); f.method = ‘POST’; f.action =
this.href; f.submit(); };return false;">[X]
john
</li>
What’s even stranger to me is that if I download the book’s code, which
has :method => :post in its list_users.rhtml template, and run that
app, it works just fine. What am I missing? I’m on rails 1.2.1, but am
really bewildered about the difference here.
Thanks for your patience.