app/helpers/trestle/url_helper.rb in trestle-0.8.10 vs app/helpers/trestle/url_helper.rb in trestle-0.8.11

- old
+ new

@@ -28,10 +28,13 @@ end admin ||= self.admin if respond_to?(:admin) if admin + # Ensure admin has controller context + admin = admin.new(self) if admin.is_a?(Class) + # Generate path action = options.delete(:action) || :show params = options.delete(:params) || {} if admin.respond_to?(:instance_path) && instance @@ -56,9 +59,12 @@ def admin_url_for(instance, options={}) admin = Trestle.lookup(options.delete(:admin)) if options.key?(:admin) admin ||= admin_for(instance) return unless admin + + # Ensure admin has controller context + admin = admin.new(self) if admin.is_a?(Class) if admin.respond_to?(:instance_path) admin.instance_path(instance, options) else admin.path(options[:action] || :show, id: admin.to_param(instance))