1

I have the following code in my view:

= form_tag(new_demo_path, :method => "put", id: "demo-form") do
  = submit_tag "Try out demo", :name => nil

This will setup a demo environment which will be accessible for 7 days. Of course I don't want search engines to click this. Since it's a put request, will this be a problem? Do I need to include something so they don't click this link?

rept
  • 2,086
  • 1
  • 26
  • 44
  • 1
    [this question](http://stackoverflow.com/questions/2387496/how-to-prevent-robots-from-automatically-filling-up-a-form) may be helpful. – Gyapti Jain Nov 17 '14 at 12:00
  • 1
    Captcha is a common tactic, to prevent bots from submitting forms – Srikanth Venugopalan Nov 17 '14 at 12:03
  • @GyaptiJain thanks, there seem to be lots of good tactics in there. I don't want to use a captcha since I want to have as few steps necessary to convince potential users... – rept Nov 17 '14 at 12:12

1 Answers1

1

Some time ago I found myself in a similar situation and I wrote a negative captcha plugin for Rails: https://github.com/markets/invisible_captcha. It's based on the honeypot strategy, the idea was to provide a better user experience.

More or less, you should add into your form:

<%= form_tag(new_demo_path, :method => "put", id: "demo-form") do %>
  <%= invisible_captcha %>
<% end %>

In your controller:

invisible_captcha only: [:new_demo] # assuming new_demo is the action that handles the form
markets
  • 6,709
  • 1
  • 38
  • 48
  • That's indeed the strategy I just implemented (based on the link Gyapti gave). This link describes it as well: http://haacked.com/archive/2007/09/11/honeypot-captcha.aspx/ Thanks! – rept Nov 17 '14 at 12:40