Displaying 20 results from an estimated 24 matches for "usersess".
Did you mean:
userless
2010 Nov 15
0
Problem testing Authlogic UserSession
...running under Rails 3.0.1., using rspec
2.1.0
I have the following:
user.rb
class User < ActiveRecord::Base
acts_as_authentic do |config|
config.login_field :email
config.ignore_blank_passwords false
config.disable_perishable_token_maintenance true
end
end
user_session.rb
class UserSession < Authlogic::Session::Base
end
user_sessions_controller_spec.rb
require ''spec_helper''
def user_session_create
@user = Factory.create(:user)
@user_session = UserSession.create(:email => @user.email, :password =>
@user.password)
end
describe UserSessionsController...
2011 Feb 13
0
Login user UserSession.create for rspec not working
I''ve got a show action for a map object which should return 200 if the
current_user is the maps owner
I have defined a method on my user object "current?" which returns
true or false if that user is the same as the current user
I have model spec set up for that which mocks UserSession.find.user
and that works fine
But for the controller test I want it to be closer to a functional
test and use the real UserSession.find.user
So Im trying to do UserSession.create in the test
When I do UserSession.find.user after that in the spec the session has
been created but in the controll...
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(par...
2010 Jan 26
1
Why does UserSession.find return nil when using user_credentials = single_access_token?
...king through the documentation, but I
must be missing something. What is it that I''m neglecting?
class UsersController < ApplicationController
def update
# params[:user_credentials].inspect shows the correct
''xxxSingle_Access_Tokenxxx''
user_hash = RegisteredUserSession.find.record
user = RegisteredUser.find(user_hash)
user.update(params[:user])
user.save
respond_to do |format|
format.json { head :ok }
end
end
private
def single_access_allowed?
true
end
end
class UserSession < Authlogic::Session::Base
allow...
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
and the following after_save callback to regenerate the profile image
if the image has changed.
after_save do |u...
2010 Nov 14
5
Authlogic and rails 3 : NameError in User sessionsController#new
...p://
railscasts.com/episodes/160-authlogic), and the resources I was able
to find on the web, but I''m facing a problem.
Once I''ve generated the user_sessions controller and mapped the login
and logout routes, I get an error if I try to load the login page :
uninitialized constant UserSessionsController::UserSession
app/controllers/user_sessions_controller.rb:11:in `new''
The user_sessions model is really simple :
class UserSession < Authlogic::Session::Base
end
But it looks like this class declaration is not considered by Rails...
Does anyone have an idea ?
Thx by adv...
2010 May 21
0
Authlogic and Single table inheritance
Hi,
I have some models such as:
class User < ActiveRecord::Base
acts_as_authentic
end
class Admin < User
end
class Superadmin < Admin
end
And some controllers such as:
class UserSessionsController < ApplicationController
def new
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = t(''user_sessions.flash.create.notice'')...
2010 Jun 10
0
uninitialized constant UserSessionsController::UserSession
This is the error I got. I am working with authlogic and was able to
register the user. But when I create user_sessions and try to login, I
got his error.
Guys can u help me out in this.
Thnak you,
Siva
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email
2010 Jul 19
6
Setting a root_url
...t the "login" page, that is, the
index.html.erb of the user_sessions_controller.
So, what I did is typed the following in the "routes.rb":
map.root :controller => "user_sessions"
But, get the following: http://pastie.org/1050272
When I changed:
@user_sessions = UserSession.all
To:
@user_sessions = UserSession.find[:all], I got the following:
http://pastie.org/1050274
Provided that, for example I have a users_controller, and when in
"routes.rb" I do:
map.root :controller => "users", I get the expected output and it works
fine.
Isn'...
2011 Jun 09
8
Fail to call
...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 < ApplicationController
def hi
@current_user
if (@current_user)
@welr = ''¡Bienvenido'' + @current...
2010 Oct 21
4
Authlogic + Rails3 - undefined method `Login' for nil:NilClass
...<%= link_to "Login", login_path %>
and I get the following error message:
undefined local variable or method `login_path'' for
#<#<Class:0x0000000311e8f8>:0x0000000310af38>
To overcome this, ive just used a string. i.e. <%= link_to "Login",
"/UserSessions/new" %>
Now it seems like i''ve reached an impasse. When i try to output the
current user with:
<%= @user.Login %>
I get an error that im unable to circumvent. Can you please help me?
Thanks :) Please find below the error message, and some of the code.
undefined method...
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
2012 Apr 09
8
Rails Functional Testing Problem
I''m trying to run some functional tests on Rails. However I am coming up
with the following error.
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you
really wanted the id of nil, use object_id
app/controllers/posts_controller.rb:11:in `create''
posts_controller_test.rb:5:in `test_should_create''
Here is my test file
require
2009 Oct 28
1
Authlogic Page View Authentication Help
...ollowing:
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
end
def require_user
unless current_user
store_location
flash[:notice] = "You must be logge...
2010 Nov 07
1
Strange authlogic logout behavior
I am using authlogic for my application''s authentication. If I decide
to login with an account and then immediately logout, I get an error.
Unknown action
The action ''show'' could not be found for UserSessionsController
The server log in development says:
Started GET "/user_session" for 127.0.0.1 at Sun Nov 07 13:28:31 -0800
2010
AbstractController::ActionNotFound (The action ''show'' could not be found
for UserSessionsController):
Rendered
/usr/lib/ruby/gems/1.8/gems/a...
2009 Oct 18
4
NoMethodError in User sessionsController#new
...arching 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"}
NoMethodError (undefined method `requir...
2009 Aug 02
13
NoMethodError in User sessionsController#create - Authlogic
...fter registration new user is automatically logged in,
he can edit his profile, but after clicking logout and trying to login
again I get error
NoMethodError in User sessionsController#create
undefined method `mb_chars'' for "rzepak":String
My user_session_controller.rb:
class UserSessionsController < ApplicationController
def new
@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 =>...
2010 Dec 02
7
Rails 3 + Authlogic not working all of a sudden
...ople,
I''ve been working on Rails 3.0.0 and Authlogic for quite a while now but
all of a sudden I can''t login into my application anymore.
After some research I found out that no sessions are stored into the db
anymore so I started the console and saw this:
ruby-1.9.2-p0 > u = UserSession.new({:username => ''Test'', :password =>
''test123''})
=> #<UserSession: {:username=>"Test", :password=>"<protected>"}>
ruby-1.9.2-p0 > u.save
NoMethodError: undefined method `cookies'' for "UserSessi...
2010 Sep 09
1
NoMethodError in User sessionsController#create
...o do with gem version conflicts, but I can''t seem to
find a solution that works.
No matter what username & password that is entered into the login form I
get the same error screen:
NoMethodError in User sessionsController#create
undefined method `protected_password'' for #<UserSession:
{:login=>"rtgh", :password=>"<protected>"}>
Trace:
.../vendor/plugins/authlogic_ldap/lib/authlogic_ldap/session.rb:251:in
`send''
.../vendor/plugins/authlogic_ldap/lib/authlogic_ldap/session.rb:251:in
`validate_by_ldap''
.../vendor/rails/activ...
2008 Dec 16
20
step definitons to check login
I am working with the authlogic gem and trying to create a simple login
test from cucumber features. The feature statement is:
Given the user is not logged in
The step definition for this is confounding me. In the
application_controller the authlogic tutorial recommends the following:
private
def require_user
unless current_user
store_location
flash[:notice] =