sequel-devise 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/sequel-devise/version.rb +1 -1
- data/lib/sequel/plugins/devise.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a05872d5e029c5f63a84d06f0b944aeb1677dee
|
4
|
+
data.tar.gz: 97d0fac7d893a05ec65eb173e4d539c8642f5d77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47682c90fcba4b707ae454eb0143dcdc312624cd89396a564d62e02d369322d6f28f113aaec32097a50bcebf4da86d5936a45735e4159e270d0c429d3a1cd654
|
7
|
+
data.tar.gz: dc950790fa7d1f97dd68a10074df071b39eef81a086d6040cef40c9f46b56a5f5108dcc5acf255fcdc0f06eb01df0be3135280201e65074254aa0c6c32477de5
|
data/README.md
CHANGED
@@ -40,6 +40,11 @@ them in this gem, but there are some cases which are trickier. For example, Devi
|
|
40
40
|
default behavior of Sequel::Model, so you'll have to change this behavior for your User classes
|
41
41
|
that are intended to be used by Devise. There are a few solutions depending on your use case:
|
42
42
|
|
43
|
+
Please make sure you take a look at the implementation to understand which methods are added
|
44
|
+
in order to support Devise. Particularly, for security reasons Devise will override inspect
|
45
|
+
so that it doesn't display passwords hashes for example among other keys. If you want the
|
46
|
+
original inspect, call `user.inspect(false)`.
|
47
|
+
|
43
48
|
### You expect your Sequel Models to not raise on save failure by default
|
44
49
|
|
45
50
|
Just disable the raise behavior by default:
|
@@ -41,6 +41,16 @@ module Sequel
|
|
41
41
|
def update_attribute(key, value)
|
42
42
|
update_attributes key => value
|
43
43
|
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def devise_safe_values
|
48
|
+
values.delete_if{|k, v| devise_safe_keys.include?(k) || k =~ /password/i }
|
49
|
+
end
|
50
|
+
|
51
|
+
def devise_safe_keys
|
52
|
+
::Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION
|
53
|
+
end
|
44
54
|
end
|
45
55
|
|
46
56
|
module ClassMethods
|
@@ -49,6 +59,18 @@ module Sequel
|
|
49
59
|
key.to_s
|
50
60
|
end
|
51
61
|
|
62
|
+
module OverrideFixes
|
63
|
+
def inspect(safe = true)
|
64
|
+
return self.class.superclass.instance_method(:inspect).bind(self)[] unless safe
|
65
|
+
"#<#{self.class} @values=#{devise_safe_values.inspect}>"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def devise_modules_hook!
|
70
|
+
yield
|
71
|
+
include OverrideFixes
|
72
|
+
end
|
73
|
+
|
52
74
|
Model::HOOKS.each do |hook|
|
53
75
|
define_method(hook) do |method = nil, options = {}, &block|
|
54
76
|
if Symbol === (if_method = options[:if])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Rosenfeld Rosas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|