lib/active_admin/resource/routes.rb in activeadmin-2.2.0 vs lib/active_admin/resource/routes.rb in activeadmin-2.3.0
- old
+ new
@@ -108,11 +108,11 @@
end
# @return params to pass to instance path
def route_instance_params(instance)
if nested?
- [instance.public_send(belongs_to_name).to_param, instance.to_param]
+ [instance.public_send(belongs_to_target_name).to_param, instance.to_param]
else
instance.to_param
end
end
@@ -121,14 +121,22 @@
params[:"#{belongs_to_name}_id"]
end
end
def nested?
- resource.belongs_to? && resource.belongs_to_config.required?
+ resource.belongs_to? && belongs_to_config.required?
end
+ def belongs_to_target_name
+ belongs_to_config.target_name
+ end
+
def belongs_to_name
- resource.belongs_to_config.target.resource_name.singular if nested?
+ belongs_to_config.target.resource_name.singular
+ end
+
+ def belongs_to_config
+ resource.belongs_to_config
end
def routes
Helpers::Routes
end