Displaying 4 results from an estimated 4 matches for "sessions_helper".
2010 Sep 03
1
Action Controller Error: undefined local variable or method `current_user'
.../sign-in-sign-out#top
At the end of the tutorial, rails is erroring (see below). being new
to Rails and after having checked the tutorial... How do you resolve
this kind of error. It''s saying current_user is not defined, and it is
supposed to be defined with/Sites/sample_app/app/helpers/
sessions_helper.rb
NameError in Pages#home
Showing /Users/iamme/Sites/sample_app/app/views/layouts/
_header.html.erb where line #6 raised:
undefined local variable or method `current_user'' for #<#<Class:
0x103371258>:0x10336be70>
Extracted source (around line #6):
3: <nav class="...
2011 Jun 12
3
Problem with undefined variable current_user
...nt_user'' for #<UsersController:0x9ffad80>
|Rails.root: /home/resource_portal/website|
Application Trace <http://localhost:3000/users/1/edit#> | Framework
Trace <http://localhost:3000/users/1/edit#> | Full Trace
<http://localhost:3000/users/1/edit#>
|app/helpers/sessions_helper.rb:17:in `signed_in?''
app/controllers/users_controller.rb:91:in `authenticate''
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:436:in `_run__1056153724__process_action__372525482__callbacks''
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib...
2012 May 12
12
before_save messing up
...:session][:email])
if user && user.authenticate(params[:session][:password])
sign_in user
redirect_to user
else
flash.now[''error''] = ''Invalid email/password combination''
render :new
end
end
def destroy
end
end
#sessions_helper.rb ------> Sessions Helper
module SessionsHelper
def sign_in(user)
cookies.permanent[:_pm] = user.remember_token
current_user = user
end
end
The problem is the cookie doesn''t get set to any value at all. It''s
always nil.
Thanks in advance for any assistance given....
2013 Jul 05
0
Sign in and sign out
Hello,
My name is Javier Molina and I am programming a simple app to manage users
in Ruby on Rails.
I read RoR Tutorial
from http://ruby.railstutorial.org/chapters/sign-in-sign-out#top to sign in
and sign out my app. I implemented the same configuration as it said:
*sessions_helper.rb*
def sign_out
self.current_user = nil
cookies.delete(:remember_token)
end
*sessions_controller.rb*
def destroy
sign_out
redirect_to root_url
end
*application.html.erb*
<%= link_to "Sign out", signout_path, method: "delete" %>
*routes.rb*
ma...