validatious-on-rails 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -70,7 +70,15 @@ module ValidatiousOnRails
|
|
70
70
|
def from_active_record(object_or_class, attribute_method)
|
71
71
|
validators = []
|
72
72
|
begin
|
73
|
-
klass = object_or_class.
|
73
|
+
klass = if [::String, ::Symbol].any? { |c| object_or_class.is_a?(c) }
|
74
|
+
object_or_class.to_s.classify.constantize
|
75
|
+
elsif object_or_class.is_a?(::Object)
|
76
|
+
object_or_class.class
|
77
|
+
else
|
78
|
+
object_or_class
|
79
|
+
end
|
80
|
+
# FIXME: Forgot how to check this on the class instead of an instance of the class.
|
81
|
+
return validators unless klass.new.is_a?(::ActiveRecord::Base)
|
74
82
|
rescue
|
75
83
|
::ValidatiousOnRails.log "Missing constant: #{object_or_class}", :debug
|
76
84
|
return validators
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validatious-on-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Grimfelt
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-23 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|