title: reading parameters from create method
body: <p>I have a ruby on rails project that is using the devise gem for authentication. I'm trying to use a captcha form in the sign up page to prevent bots from creating thousands of dummy logins</p>
  
  <p>I'm not interested in using the recaptcha gem that works with devise as I haven't had any luck setting it up correctly.</p>
  
  <p>I trying to set it up using this as a reference <a href="https://recaptchainrubyonrails.blogspot.com/" rel="nofollow noreferrer">https://recaptchainrubyonrails.blogspot.com/</a></p>
  
  <p>Here's my sign up page </p>
  
  <pre><code>&lt;h2&gt;Sign up&lt;/h2&gt;
  
  &lt;%= form_for(resource, as: resource_name, url: 
  registration_path(resource_name)) do |f| %&gt;
  &lt;%= devise_error_messages! %&gt;
  
  &lt;div class="field"&gt;
    &lt;%= f.label :email %&gt;&lt;br /&gt;
    &lt;%= f.email_field :email, autofocus: true, autocomplete: "email" %&gt;
  &lt;/div&gt;
  
  &lt;div class="field"&gt;
    &lt;%= f.label :password %&gt;
    &lt;% if @minimum_password_length %&gt;
    &lt;em&gt;(&lt;%= @minimum_password_length %&gt; characters minimum)&lt;/em&gt;
    &lt;% end %&gt;&lt;br /&gt;
    &lt;%= f.password_field :password, autocomplete: "off" %&gt;
  &lt;/div&gt;
  
  &lt;div class="field"&gt;
    &lt;%= f.label :password_confirmation %&gt;&lt;br /&gt;
    &lt;%= f.password_field :password_confirmation, autocomplete: "off" %&gt;
  &lt;/div&gt;
  
  &lt;div class="g-recaptcha" data 
  sitekey="6LeeL5gUAAAAADbq0vt4d9biAs8oegkPx9ttUkKb"&gt;&lt;/div&gt;
  
  &lt;div class="actions"&gt;
    &lt;%= f.submit "Sign up" %&gt;
  &lt;/div&gt;
  &lt;% end %&gt;
  &lt;br&gt;
  </code></pre>
  
  <p>I do have my routes file point to a separate registrations controller instead of the one created within the devise registrations</p>
  
  <pre><code>devise_for :users, path: '', path_names: { sign_in: 'login', sign_out: 'logout' }, :controllers =&gt; {:registrations =&gt; "registrations"}
  </code></pre>
  
  <p>I can create a user regardless if I click on the captcha form. When I do click on it I get the parameter, g-recaptcha-response, in the create method that has a long text string such as </p>
  
  <pre><code>"g-recaptcha-response"=&gt;"1234567890abcdefghi..."
  </code></pre>
  
  <p>I tried a create method that would look at that parameter and see if it is not nil. When it is nil I would like to back one page to the sign up page.</p>
  
  <pre><code>class RegistrationsController &lt; Devise::RegistrationsController
  
    def create
        if not params[:g-recaptcha-response].present?
          redirect_to :back
        end
    end
  end 
  </code></pre>
  
  <p>I can't even get to the parameter as it errors out saying </p>
  
  <pre><code>undefined local variable or method `recaptcha' for #&lt;RegistrationsController:0x7219e5a0&gt; Did you mean? catch"
  </code></pre>
  
  <p>I'm trying to capture this parameter, look at the value of g-recaptcha-response and somehow cancel the creation of a user if the response was nil or empty string</p>