Geez. Could I trouble you for some education on why you need the {} around the :method => :post
???
Thanks!
Main Topics
Browse All TopicsI'm sure this is really easy - once you know rails - (or if you haven't been living in a .NET sandbox for 5 years), but, how can I get a regular ole form submit button in the shape of a link?
I tried taking <%= link_to url "Click Me", { :action => "foo"} %>
and turning it into
<%= link_to url "Click Me", :method => :post, { :action => "foo"} %>
but that created some weird error that I don't have right this second. I know you can also set up a regular <a> tag, and point it to a javascript function that submits the form, but I know there's got to be a Rails way to do this.
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sure,
The method takes two hash arguments. Ruby will automatically convert what it sees last in the call to hash, if it is in a hash form. However, if you are going to supply two separate hashes: one has the url description and a second as html_parameters, then you would have to use the proper Hash class form { }.
Hope this helps,
OA
I'm completely new to rails - so would you mind explaining why the following works (from Rails API). Why does this example not need the {} - I don't care about adding the {} - I just want to understand better what I'm doing. Thanks!
link_to "Delete Image", @image, :confirm => "Are you sure?", :method => :delete
# => <a href="/images/9" onclick="if (confirm('Are you sure?')) { var f = document.createElement('fo
f.style.display = 'none'; this.parentNode.appendChil
var m = document.createElement('in
m.setAttribute('value', 'delete'); f.appendChild(m);f.submit(
Business Accounts
Answer for Membership
by: ozatamanPosted on 2008-10-10 at 09:02:19ID: 22688028
Hey there,
You should do:
<%= link_to "Click Me", { :action => "foo"}, {:method => :post} %>
Cheers,
OA