I have a button as below.
<%= button_to('On', @userdetail.url + '?value=1', :method => "post", :remote => true, :disable_with => 'loading...') %>
In the button above, @userdetail.url is an external url. But I don’t want to show that external url when somebody does a view source.
Is there any way I can achieve it.
Writing a controller action will do so, but I am not able to make everything work through controller action.
Here’s what I tried.
In a controller action how can I define a post method.
Should I execute a curl post call to achieve this.
Should I try something like this in controller action.
def button_action @userdetail = Userdetail.find(params[:id]) curl @userdetail.url + "?value=" + value end
and define a route. I tried this but it didn’t work.
Any live example to do a post to external URL via controller action and using the same in the button_to will help.