has_response 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/concerns/has_response.rb +3 -5
- data/lib/has_response/version.rb +1 -1
- metadata +1 -1
@@ -29,14 +29,12 @@ module HasResponse
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def format_response_value(value, with=nil)
|
32
|
-
if value.
|
33
|
-
nil
|
34
|
-
elsif value.is_a?(TrueClass) || value.is_a?(FalseClass) || value.is_a?(String) || value.is_a?(Symbol) || value.is_a?(Integer)
|
35
|
-
value
|
32
|
+
if value.is_a?(ActiveRecord::Base)
|
33
|
+
with.nil? ? value.to_response : value.to_response_with(with)
|
36
34
|
elsif value.is_a?(ActiveRecord::Relation) || value.is_a?(Array)
|
37
35
|
format_response_collection(value, with)
|
38
36
|
else
|
39
|
-
|
37
|
+
value
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
data/lib/has_response/version.rb
CHANGED