Displaying 9 results from an estimated 9 matches for "sign_out".
Did you mean:
in_out
2011 Nov 02
1
getting devise to return json data when signing out
...they are never logged out. So I want
to be able to log out via curl and return json (curl is my testing
devise right now, but ultimately I intend this to work through the
iphone).
I add this to users/session controller:
def destroy
respond_to do |format|
format.json {
return sign_out_and_redirect(resource_or_scope)
}
end
end
def sign_out_and_redirect(resource_or_scope)
scope = Devise::Mapping.find_scope!(resource_or_scope)
if Devise.sign_out_all_scopes
sign_out_all_scopes
else
sign_out(scope)
end
return ren...
2010 Sep 03
1
Action Controller Error: undefined local variable or method `current_user'
...9;'
---- END
sessions_helper.rb CODE:
module SessionsHelper
def sign_in(user)
cookies.permanent.signed[:remember_token] = [user.id, user.salt]
current_user = user
end
def current_user=(user)
@current_user = user
end
def signed_in?
!current_user.nil?
end
def sign_out
cookies.delete(:remember_token)
self.current_user = nil
end
private
def user_from_remember_token
User.authenticate_with_salt(*remember_token)
end
def remember_token
cookies.signed[:remember_token] || [nil, nil]
end
end
--- END
thanks
--
You received this message...
2011 Jun 13
0
Devise Authorization Error
...routes.rb ---
# Root
root :to => "content#index"
# Admin Controllers
namespace ''admin'' do
root :to => "admin#index"
# AdminController
devise_for :admin, :path=> '''', :path_names => {:sign_in =>
''login'', :sign_out => ''logout''}
resources :admin
end
# UsersController
devise_for :users, :path_names => {:sign_in => ''login'', :sign_out =>
''logout''}
--- END routes.rb ---
--- admin.rb (Model) ---
class Admin < ActiveRecord::Base
devise :data...
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*
match ''/si...
2013 Jul 04
3
Rspec devise, testing extended RegistrationController action destroy
...ve extended the destroy action from the RegistrationController, to soft
delete users instead of really deleting them from the database.
def destroy
# raise resouce.inspect # this is just to see if the test hits the
action
resource.soft_delete
set_flash_message :notice, :destroyed
sign_out resource
redirect_to new_session_path(resource)
end
This is working on the browser.
When I try to write a test to the delete action, I get the test as passed
but does not execute the code. Prove of that is I have put a raise on the
action and it did not raise it. I have also tried to tes...
2010 Jan 17
0
some routes don't load in production
...are
made in the plogger_thinking_sphinx plugin.
My problem is, for some reason, the modification I''m making in my
plogger_thinking_sphinx plugin is throwing off some of my routes I''m
using with other gems. Specifically, I''m using Devise for
authentication, and my sign_in/sign_out links are disappearing-- but
ONLY in "production" mode. In addition, any authentication-related
before_filters in my controllers are being ignored, so authentication
is silently failing.
The offending code is in plogger_thinking_sphinx, where I''m adding
define_index to my model...
2011 Jul 14
10
Devise confusing routes
...directing me to the
Sign In screen. Seems like I didn''t fix the problem completely.
I think Devise is confusing the routes. If I do rake routes, I get
this...
new_user_session GET /users/sign_in(.:format)
user_session POST /users/sign_in(.:format)
destroy_user_session DELETE /users/sign_out(.:format)
new_user GET /users/new(.:format)
edit_user GET /users/:id/edit(.:format)
user GET /users/:id(.:format)
This is routes.rb
devise_for :users, :controllers => { :registrations =>
''users/registrations'' }
resources :companies
resources :users
resources :co...
2012 Jul 17
24
Static Pages from Railcast
Hi everyone,
I need several pages to be static but also modify when requested. I try
following the railcast from Ryan at
http://railscasts.com/episodes/117-semi-static-pages?view=comments
Here what I have done!!
rails g scaffold Pages name:string permanentlink:string title:string
author:string access_level:string is_published:boolean
meta_description:string meta_keyword:string
2011 Jul 30
22
Question about Helpers
Studying the RoR 3 Tutorial book by Michael Hartl
and on page 345 there''s the code inside the SessionsHelper:
_________________________________________________________
module SessionsHelper
def sign_in(user)
cookies.permanent.signed[:remember_token] = [user.id, user.sault]
self.current_user = user
end
end
__________________________________________________________
What is the purpose