lib/scrivito/cms_routing.rb in scrivito_sdk-0.60.0 vs lib/scrivito/cms_routing.rb in scrivito_sdk-0.65.0.rc1
- old
+ new
@@ -87,21 +87,22 @@
obj.binary_url
else
LINK_TO_EMPTY_BLOB
end
else
- id_path_or_url_for_objs(obj, path_or_url, options)
+ slug = obj.slug.present? ? obj.slug.sub(/^\//, '') : nil
+ id_path_or_url_for_objs(obj, path_or_url, options.merge(slug: slug))
end
end
def id_path_or_url_for_objs(obj, path_or_url, options)
- main_app.public_send(
- "cms_id_#{path_or_url}",
- options.merge(
- id: obj.id,
- slug: obj.slug.presence
- )
- )
+ method_name = if Scrivito::Configuration.legacy_routing
+ "cms_legacy_id_#{path_or_url}"
+ else
+ "cms_id_#{path_or_url}"
+ end
+
+ main_app.public_send(method_name, options.merge(id: obj.id))
end
def editor_authenticated?
editing_context.authenticated_editor?
end