Displaying 15 results from an estimated 15 matches for "current_user_sess".
2011 Jun 09
8
Fail to call
...;'m trying create a user system for a future project but I have a
problem when I want give to my users the "Welcome". This is my code:
#application_controller
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
@current_user = current_user_session && current_user_session.user
end
end
#welcome_controller
class WelcomeController < ApplicationControlle...
2009 Oct 18
4
NoMethodError in User sessionsController#new
I''m setting up authentication with Authlogic and I get this error.
I''ve done some searching but with no success. I tried setting the
current_user method in Application_controller to protected and not
private, on the recommendation in Stack Overflow.
Error in browser-----------------
NoMethodError in User sessionsController#new
undefined method `require_no_user'' for
2009 Oct 28
1
Authlogic Page View Authentication Help
...am a newbie at ROR, and I am grasping my head around Authlogic. I am
having hard time trying to figure out how can I do the following:
in my application controller I have the following helpers:
filter_parameter_logging :password, :password confirmattion
helper_method :all
private
def current_user_session
return @current_user_session if defined?
(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session &&
current_user_session.user...
2010 Oct 30
3
Authlogic not active
...<li><%= nav_link "Login", "authentications", "login"
%></li>
class ApplicationController < ActionController::Base
protect_from_forgery
filter_parameter_logging :password, :password_confirmation
helper_method :current_user
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = Authentication.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session &&
current_user_session.user
end
aut...
2010 Jul 28
1
paperclip, authlogic and callback issue
I use authlogic for authentication and paperclip for handling user''s
profile picture attachments.
I use the following method to get the current_user
def current_user_session
return @current_user_session if defined?
(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session &&
current_user_session.record
end...
2010 Oct 21
4
Authlogic + Rails3 - undefined method `Login' for nil:NilClass
...branch => "rails3"
config/routes.rb:
resources :users
resources :user_sessions
resources :ibe
match '':controller(/:action(/:id(.:format)))''
controllers/application_controller.rb: [the part that gets the current
user.. also taken from online examples]
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session && current_user_session.record
end
models/user_sessio...
2010 May 21
0
Authlogic and Single table inheritance
...@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = t(''user_sessions.flash.create.notice'')
redirect_to root_path
else
render :action => :new
end
end
def destroy
current_user_session.destroy
flash[:notice] = t(''user_sessions.flash.destroy.notice'')
redirect_to new_session_path
end
end
class Admin::AdminSessionsController < ApplicationController
layout ''admin''
def new
@user_session = Use...
2010 Jul 15
2
Authlogic admin user functionality
I am using authlogic as a authentication engine in my rails app.
I have two types of users 1) Users who are registered and has access
to there own profile.
2) Admin user who has access to everybody''s profile
In the user table i have a :is_admin field boolean field which defines
the admin user.
like the current_user method, Is there a way authlogic provides which
can tell me if the
2009 Dec 25
18
rescue_from ActionController::RoutingError II
...the most recent authlogic
code:
------------------------
# Filters added to this controller apply to all controllers in the
application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all
helper_method :current_user_session, :current_user
filter_parameter_logging :password, :password_confirmation
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if def...
2011 Jun 11
7
"Stack level too" deep with @controller.hi
...uot;if" for show a different message
for a registered user or a guest. When I call in "home/index" my
method "hi", show me this error message:
"Stack level too deep"
class HomeController < ApplicationController
def hi
if (current_user)
@username = current_user_session.user.username
@welr = ''¡Bienvenid@ '' + @username.to_s + '' a nuestra web!''
render ''home/index''
else
@weli = "¡Bienvenid@ invitad@, no dude en registrarse!"
end
end
end
# home/index
<p>Holaaaa</p&...
2010 May 04
2
Session Store Issues on Production Server
...essly. In other words, a user cannot log out. I have tried
implementing the Active Record session store and have changed
the :secret key in initializers/session_store.rb, but for some reason,
it is not resetting my users. Another interesting note is that in the
Appplication Controller if I force current_user_session to return
false, the user is logged out (of course). The problem seems to be
coming from user_session.delete.
Has anyone encountered this before? Is there something in Rack that
is holding this back?
Thanks!
--
You received this message because you are subscribed to the Google Groups "...
2011 Jun 01
7
desperate, errors with file upload
hello,
i implementing a file upload using paperclip plugin. i getting the
following error [1] when uploading a file. I''m using the gems rails
v2.3.8 and paperclip v2.1.6. the parameter hash looks like [2], the
model like [3].
Interesting is that i get two different errors, on the localhost with
webrick it says:
Status: 500 Internal Server Error
no marshal_dump is defined for class
2010 Nov 07
1
Strange authlogic logout behavior
...serSession.new
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "Login successful!"
redirect_to :controller => "list"
else
render :action => :new
end
end
def destroy
current_user_session.destroy
flash[:notice] = "Logout complete. Have a nice day!"
redirect_to root_url
end
end
[/code]
application layout file snippet
[code]
<% if current_user %>
<li><a><%= link_to current_user.login, edit_user_path(:current)
%></a></li>
&...
2011 Jun 29
6
RSpec with Rails 3.1rc4: spec test won't recognize <%= %> (should be simple)
...= "Hello."
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "Login successful!"
redirect_back_or_default admin_path
else
render :action => :new
end
end
def destroy
current_user_session.destroy
flash[:notice] = "Logout successful!"
redirect_back_or_default new_user_session_url
end
end
========
In views/user_sessions/new.html.erb:
<!--user_sessions#new-->
Admin Login
<%= @message %>
========
In spec/views/user_sessions/new.html.erb_spec.rb:
re...
2009 Aug 02
13
NoMethodError in User sessionsController#create - Authlogic
...w
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "Successfully logged in."
redirect_to root_url
else
render :action => ''new''
end
end
def destroy
current_user_session.destroy
flash[:notice] = "Successfully logged out."
redirect_to root_url
end
end
I was trying to google this error, but with no success, so I hope I will
find some help here
gem -v 1.3.5
ruby -v ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
--
Posted via http://www.ruby-...