app/helpers/rails_admin/navigation_helper.rb
def admin_back_home
      if request.path =~ CMSViewableEdit
        viewable = extract_viewable($1, $2)
        view_path, name, type = viewable.slice(:view_path, :unique_key_name, :viewable_type).values

        if type == 'Viewable::Page'
          path = viewable.url
        elsif name =~ CMSPageUUID
          path = Viewable::Page.find_by_uuid($1).url
        elsif view_path == 'spree/users/show'
          path = spree.account_path
        else
          case view_path
          when CMSPageType, CMSPageFormType, CMSFormType
            path = main_app.try "#{$1}_path"
          when /\/(\w+)\/index$/
            resources = $1
            if resources.singularize == resources
              path = main_app.try "#{resources}_index_path"
            else
              path = main_app.try "#{resources}_path"
            end
          when /\/\w+\/show$/
            scopes = view_path.split('/')
            scopes.pop
            resource = scopes.pop.singularize
            namespace = scopes.map(&:camelize).join('::')
            first_object = "#{namespace}::#{resource.camelize}".constantize.first

            if first_object
              path = main_app.try "#{resource}_path", first_object
            end
          end
        end
      end

      path ||= main_app.root_path

      content_tag :li do
        link_to t('admin.home.name'), path
      end
    end
def admin_back_home
      if request.path =~ CMSViewableEdit
        viewable = extract_viewable($1, $2)
        view_path, name, type = viewable.slice(:view_path, :unique_key_name, :viewable_type).values

        if type == 'Viewable::Page'
          path = viewable.url
        elsif name =~ CMSPageUUID
          path = Viewable::Page.find_by_uuid($1).url
        elsif view_path == 'spree/users/show'
          path = spree.account_path
        else
          case view_path
          when CMSPageType, CMSPageFormType, CMSFormType
            path = main_app.try "#{$1}_path"
          when /\/(\w+)\/index$/
            resources = $1
            if resources.singularize == resources
              path = main_app.try "#{resources}_index_path"
            else
              path = main_app.try "#{resources}_path"
            end
          when /\/\w+\/show$/
            scopes = view_path.split('/')
            scopes.pop
            resource = scopes.pop.singularize
            namespace = scopes.map(&:camelize).join('::')
            first_object = "#{namespace}::#{resource.camelize}".constantize.first

            if first_object
              path = main_app.try "#{resource}_path", first_object
            end
          end
        end
      end

      path ||= main_app.root_path

      content_tag :li do
        link_to t('admin.home.name'), path
      end
    end
TODO: simplify by adding a reference param on 'link to edit' client-side