I checked the log file, I found that, the bug is
Dall::error server not found
Then I installed memcached by doing sudo apt-get install memcached
. It works fine now. For more clarification, click the below link
Question
I am using devise for authentication,
I put some text after "super" in SessionsController#create method like below, to find the "current_user" value in the browser(using better_errors gem).
class SessionsController < Devise::SessionsController
def new
super
end
def create
super
error_debug
end
def edit
super
end
end
in routes.rb
root :to => "welcome#index"
I got the current_user value like expected in SessionsController#create, but current user value is 'nil' when it comes to welcome#index method even after signin.
I can't able to find the reason behind it, please someone assist me to resolve this issue.
Solution 2
I checked the log file, I found that, the bug is
Dall::error server not found
Then I installed memcached by doing sudo apt-get install memcached
. It works fine now. For more clarification, click the below link
OTHER TIPS
First signed in and check in better_error value of current_user
Follow the below steps:
gem install 'devise'
rails generate devise:install
rails generate devise User
rake db:migrate
Your Routes should be like this devise_for :users > root :to => "home#index"
Change your development config add following line to config/environments/development.rb
config.action_mailer.default_url_options = { host: 'localhost:3000' }
Add this code to your controller
before_filter :authenticate_user!
And if you are using rails 4 so add this code to your application
class ApplicationController < ActionController::Base
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit({ roles: [] }, :email, :password, :password_confirmation) }
devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email) }
end end
Do you have protect_from_forgery method call in your application controller? Look at this guides.rubyonrails.org/security.html