Sha256: daf0b25eb7e1a686fd068fcbec8d461ab3ab4c53ea2fd10c2c9371d99a865560

Contents?: true

Size: 783 Bytes

Versions: 7

Compression:

Stored size: 783 Bytes

Contents

module AbAdmin
  module Views
    module UrlForRoutes
      extend ActiveSupport::Concern

      included do
        protected

        def resource_path(rec=nil, options={})
          r = rec || resource
          options.reverse_merge!(:id => r.id, :action => :show)
          url_for options
        end

        def edit_resource_path(rec=nil, options={})
          r = rec || resource
          options.reverse_merge!(:id => r.id, :action => :edit)
          url_for options
        end

        def new_resource_path(options={})
          options.reverse_merge!(:action => :new)
          url_for options
        end

        def collection_path(options={})
          options.reverse_merge!(:action => :index)
          url_for options
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.2.3 lib/ab_admin/views/url_for_routes.rb
ab_admin-0.2.2 lib/ab_admin/views/url_for_routes.rb
ab_admin-0.2.1 lib/ab_admin/views/url_for_routes.rb
ab_admin-0.2.0 lib/ab_admin/views/url_for_routes.rb
ab_admin-0.1.2 lib/ab_admin/views/url_for_routes.rb
ab_admin-0.1.1 lib/ab_admin/views/url_for_routes.rb
ab_admin-0.1.0 lib/ab_admin/views/url_for_routes.rb