title: Devise Registration form on any page
body: <p>I'm trying to allow users to sign up for the site on my home/landing page.
  I've duplicated the devise registration form into my landing page view-</p>
  
  <pre><code>&lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; registration_path(resource_name)) do |f| %&gt;
    &lt;%= devise_error_messages! %&gt;
  
    &lt;div&gt;&lt;%= f.label :first_name %&gt;&lt;br /&gt;
    &lt;%= f.text_field :first_name %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.label :last_name %&gt;&lt;br /&gt;
    &lt;%= f.text_field :last_name %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.label :profile_name %&gt;&lt;br /&gt;
    &lt;%= f.text_field :profile_name %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.label :email %&gt;&lt;br /&gt;
    &lt;%= f.email_field :email %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.label :password %&gt;&lt;br /&gt;
    &lt;%= f.password_field :password %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.label :password_confirmation %&gt;&lt;br /&gt;
    &lt;%= f.password_field :password_confirmation %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.submit "Sign up" %&gt;&lt;/div&gt;
  &lt;% end %&gt;
  
  &lt;%= render "devise/shared/links" %&gt;
  </code></pre>
  
  <p>And I've also <a href="https://github.com/plataformatec/devise/wiki/How-To%3a-Display-a-custom-sign_in-form-anywhere-in-your-app">added the helper methods</a> in my <code>application_controller.rb</code> so that I properly define the resource-</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    protect_from_forgery
    def resource_name
      :user
    end
  
    def resource
      @resource ||= User.new
    end
  
    def devise_mapping
      @devise_mapping ||= Devise.mappings[:user]
    end
  end
  </code></pre>
  
  <p>However I'm still getting the error <code>undefined local variable or method</code> <code>resource'</code>for #&lt;#:0x007fa816b4b750>`</p>
  
  <p>What am I missing here to properly render a REGISTRATION form on my home landing page?</p>