SOLVED: Im was using the method ‘clear_helpers’ in ApplicationController, so it was blocking Devise to load his helpers.
Hello,
When I run my application in the first time on ‘development’ mode, I get this error, when I reload the error desapear. When I run on ‘production’ the error still, because production loads application only one time (?), so what is happening? Someone can help?
Error:
undefined method `user_signed_in?' for #<#<Class:0x10312ddc0>:0x103127100>
Extracted source (around line #16):
13:
14: #top
15: = link_to '', root_path, :id => 'logo'
16: - if user_signed_in?
17: #session
18: %p= raw "Olá <b>#{current_user.email}</b>"
19: #myaccount.button{:onclick => "javascript: document.location.href = '#{edit_user_registration_path}'"}
Im using Devise with following setup:
Rails: 3.1, Devise: 1.3.4
My model:
class User::Account < ActiveRecord::Base
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
:rememberable, :registerable, :trackable, :timeoutable, :validatable,
:token_authenticatable
end
Routes:
Foco::Application.routes.draw do
devise_for :users, :class_name => 'User::Account'
root :to => 'main/cockpit#index', :constraints => lambda {|r| r.env["warden"].authenticate? }
devise_scope :user do
root :to => "devise/registrations#new"
end
end
My controller:
class Main::CockpitController < ApplicationController
before_filter :authenticate_user!
def index
end
end
Thanks!
The method ‘clear_helpers’ in ApplicationController was blocking Devise to load his helpers.
So I removed this method and app works.