hara acharya wrote in post #1115165:
> Hi,
> I have a button as below.
> <%= button_to('On', @userdetail.url + '?value=1', :method => "post",
> :remote => true, :disable_with => 'loading...') %>
> Here @userdetail.url is a external URL, and I don't want to show the url
> in
> view source for users.

What, are you trying to be sneaky and expose the user to web content 
they never intended to visit? Not that this isn't done all the time. 
Especially when talking about inserted ads that are embedded in iframes.

> How can I create a controller action to do the task and point the button
> to
> that controller action? Tried implementing curl in my controller action
> but
> couldn't make it work as this button action is a post method.

The same way to define any controller action. Create a route for it. If 
using a resources route you can add an additional RESTful action as 
described  in the documentation.

http://guides.rubyonrails.org/routing.html#adding-more-restful-actions

You don't need curl. Ruby has a perfectly fine method for accessing 
URIs:

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/open-uri/rdoc/OpenURI.html

> Any example help will help.
> I am also trying to expose the button action as a API. Is there anyway I
> can expose the same controller action as a API?

A request is a request. It doen't matter whether you send it with a 
button, or with any other way of sending an HTTP request.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3baf8b13c65c822dbe9597e94fa16ea5%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to