I saw a few tutorials about setting up devise for all pages using helper, but I can't achieve the same result, here are my code.
I'm following this tutorial but it's not working: https://github.com/plataformatec/devise/wiki/How-To:-Display-a-custom-sign_in-form-anywhere-in-your-app
I have a controller for my pages(now I only have the landing page)
pages_controller.rb
class PagesController < ApplicationController
def landing
end
end
and I have a header partial in views/layouts/shareds/_header.html.erb where I am calling the devise sign up/sign in.
<div class="col-md-5">
<div class="signup-header wow fadeInUp">
<h3 class="form-title text-center">GET STARTED</h3>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>
<div class="field">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="actions">
<%= f.submit "Sign up" %>
</div>
<% end %>
</div>
</div>
following the tutorial I did:
application_helper.rb
module ApplicationHelper
helper_method :resource_name, :resource, :devise_mapping
def resource_name
:user
end
def resource
@resource ||= User.new
end
def devise_mapping
@devise_mapping ||= Devise.mappings[:user]
end
end
application_controller.rb
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
include ApplicationHelper
end
I keep getting this error: undefined method `helper_method' for ApplicationHelper:Module

helper_methodis available in ApplicationController, not view helpers. Move your methods to ApplicationController and usehelper_methodthere. Then the methods will be available in both your controllers and views. - AOG