Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

enabling hooks

  • Loading branch information...
commit c4e1b9b53c8bbec0eee3797562bd09dedd69e85d 1 parent 7f6ee23
@shenoudab authored
View
3  .gitignore
@@ -1,4 +1,5 @@
.bundle/
log/*.log
pkg/
-test/
+nbproject/
+test/
View
8 lib/devise_traceable.rb
@@ -2,5 +2,9 @@
require 'devise'
end
-require 'devise_traceable/model'
-require 'devise_traceable/rails'
+module DeviseTraceable
+ require 'devise_traceable/rails'
+end
+
+Devise.add_module :traceable, :model => 'devise_traceable/model'
+
View
6 lib/devise_traceable/hooks/traceable.rb
@@ -4,13 +4,15 @@
# not trigger it.
Warden::Manager.after_set_user :except => :fetch do |record, warden, options|
+ puts record
if record.respond_to?(:insert_login!) #&& warden.authenticated?(options[:scope])
record.insert_login!(warden.request)
end
end
-Warden::Manager.before_logout do |record, auth, opts|
- if record.respond_to?(:update_logout!) #&& warden.authenticated?(options[:scope])
+Warden::Manager.before_logout do |record, warden, opts|
+ puts record
+ if record.respond_to?(:update_logout!)
record.update_logout!(warden.request)
end
end
View
7 lib/devise_traceable/rails.rb
@@ -1,5 +1,8 @@
+require 'devise_traceable'
+require 'rails'
+
module DeviseTraceable
class Engine < ::Rails::Engine
-
+ engine_name :devise_taceable
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.