Displaying 8 results from an estimated 8 matches for "require_no_user".
2009 Oct 18
4
NoMethodError in User sessionsController#new
...s 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 #<UserSessionsController:
0x24fc700>
Error in terminal------------------
Processing UserSessionsController#new (for 127.0.0.1 at 2009-10-17
23:26:38) [GET]
Parameters: {"action"=>"new", "controller"=>"user_sessions"}
NoMethodErr...
2008 Dec 16
20
step definitons to check login
...ntroller the authlogic tutorial recommends the following:
private
def require_user
unless current_user
store_location
flash[:notice] = "You must sign in to access this page"
redirect_to new_user_session_url
return false
end
end
def require_no_user
if current_user
store_location
flash[:notice] = "You must be logged out to access this page"
redirect_to account_url
return false
end
As these are private methods they are not directly accessible from the
step definitions and I am at a loss as...
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
...plates/rescues/unknown_action.erb
within rescues/layout (0.9ms)
Now if I login and the click on some other links within the application
and then logout, the logout function works as it should.
user_sessions controller
[code]
class UserSessionsController < ApplicationController
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => :destroy
def new
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "Login successful!"
redirec...
2011 Jun 29
6
RSpec with Rails 3.1rc4: spec test won't recognize <%= %> (should be simple)
In my user_sessions_controller:
class UserSessionsController < ApplicationController
before_filter :require_no_user, :only => [:create, :new]
before_filter :require_user, :only => :destroy
def new
@user_session = UserSession.new
@message = "Hello."
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "...
2009 Jul 25
3
Rails Authorization and Security question
Working through the Users and Authentication of Learning Rails book
(great book, code needs to be proof-read in a few cases, though), I
came across this:
There''s still one leftover that may be worth addressing, depending on
your security needs. The authorization? method has secured the data,
and the view no longer shows the user options they can''t really use,
but if a
2010 Oct 21
4
Authlogic + Rails3 - undefined method `Login' for nil:NilClass
...ion
def persisted?
false
end
def to_key
new_record? ? nil : [ self.send(self.class.primary_key) ]
end
end
models/user.rb:
class User < ActiveRecord::Base
acts_as_authentic
end
controllers/users_controller.rb:
class UsersController < ApplicationController
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => [:show, :edit, :update]
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = "Account registered!"
redirect_back_or_default account_url...
2009 Dec 25
18
rescue_from ActionController::RoutingError II
..._user_session &&
current_user_session.record
end
def require_user
unless current_user
store_location
flash[:notice] = "You must be logged in to access this page"
redirect_to new_user_session_url
return false
end
end
def require_no_user
if current_user
store_location
flash[:notice] = "You must be logged out to access this page"
redirect_to account_url
return false
end
end
def store_location
session[:return_to] = request.request_uri
end
def redirect_back_...