josevalim-inherited_resources 0.6.0 → 0.6.1
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.
data/README
CHANGED
@@ -339,7 +339,9 @@ Remember that our projects have pretty urls? So if you thought that url like
|
|
339
339
|
belongs_to :project, :finder => :find_by_title!, :param => :project_title
|
340
340
|
end
|
341
341
|
|
342
|
-
|
342
|
+
It also accepts :route_name, :parent_class and :instance_name as options.
|
343
|
+
For more information, check the lib/inherited_resources/class_method.rb file
|
344
|
+
for more customization. :)
|
343
345
|
|
344
346
|
Nested belongs to
|
345
347
|
-----------------
|
@@ -254,14 +254,16 @@ module InheritedResources #:nodoc:
|
|
254
254
|
:class_name, :route_prefix, :route_collection_name,
|
255
255
|
:route_instance_name, :singleton)
|
256
256
|
|
257
|
-
|
258
|
-
self.resource_class = options.delete(:
|
259
|
-
self.resource_class = options.delete(:class_name).constantize if options[:class_name]
|
257
|
+
self.resource_class = options.delete(:resource_class) if options.key?(:resource_class)
|
258
|
+
self.resource_class = options.delete(:class_name).constantize if options.key?(:class_name)
|
260
259
|
|
261
260
|
acts_as_singleton! if options.delete(:singleton)
|
262
261
|
|
262
|
+
config = self.resources_configuration[:self]
|
263
|
+
config[:route_prefix] = options.delete(:route_prefix) if options.key?(:route_prefix)
|
264
|
+
|
263
265
|
options.each do |key, value|
|
264
|
-
|
266
|
+
config[key] = value.to_sym
|
265
267
|
end
|
266
268
|
|
267
269
|
InheritedResources::UrlHelpers.create_resources_url_helpers!(self)
|
@@ -45,7 +45,7 @@ module InheritedResources #:nodoc:
|
|
45
45
|
polymorphic = false
|
46
46
|
|
47
47
|
# Add route_prefix if any.
|
48
|
-
resource_segments << resource_config[:route_prefix]
|
48
|
+
resource_segments << resource_config[:route_prefix] unless resource_config[:route_prefix].blank?
|
49
49
|
|
50
50
|
# Deal with belongs_to associations and polymorphic associations.
|
51
51
|
# Remember that we don't have to build the segments in polymorphic cases,
|
data/test/class_methods_test.rb
CHANGED