purzelrakete-restful 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,8 @@ module Restful
|
|
35
35
|
# attributes in self.class.restful_config are shown. this can be overriden
|
36
36
|
# by passing in something like @pet.to_restful(:name, :species).
|
37
37
|
#
|
38
|
-
def to_restful(
|
38
|
+
def to_restful(config_parameter = nil)
|
39
|
+
config = config_parameter
|
39
40
|
add_to_whitelist = []
|
40
41
|
|
41
42
|
if config && config.is_a?(Hash) && config.keys.size == 1 && includes = config[:include]
|
@@ -62,7 +63,7 @@ module Restful
|
|
62
63
|
if self.is_a?(Array)
|
63
64
|
elements = self.map do |el|
|
64
65
|
raise TypeError.new("Not all array elements respond to #to_restful. ") unless el.respond_to?(:to_restful)
|
65
|
-
Restful::Converters::ActiveRecord.convert(el, el.class.restful_config)
|
66
|
+
Restful::Converters::ActiveRecord.convert(el, !config_parameter.nil? ? Config.new(config_parameter) : el.class.restful_config)
|
66
67
|
end
|
67
68
|
|
68
69
|
element_name = elements.first ? elements.first.name.pluralize : "nil-classes"
|
@@ -74,7 +75,7 @@ module Restful
|
|
74
75
|
elsif self.is_a?(Hash)
|
75
76
|
elements = self.map do |k,v|
|
76
77
|
if v.respond_to?(:to_restful) and v.class.respond_to?(:restful_config)
|
77
|
-
value = Restful::Converters::ActiveRecord.convert(v, v.class.restful_config)
|
78
|
+
value = Restful::Converters::ActiveRecord.convert(v, !config_parameter.nil? ? Config.new(config_parameter) : v.class.restful_config)
|
78
79
|
else
|
79
80
|
value = v.respond_to?(:to_restful) ? v.to_restful : v
|
80
81
|
end
|
data/restful.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "restful"
|
3
|
-
s.version = "0.2.
|
3
|
+
s.version = "0.2.10"
|
4
4
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
5
5
|
s.authors = ["Daniel Bornkessel", "Rany Keddo"]
|
6
6
|
s.date = "2009-08-11"
|