Sha256: 33bdb773ad0d7d8ea45bc415d164f3adc906461c1feb5b0d003713418f4937a1
Contents?: true
Size: 904 Bytes
Versions: 4
Compression:
Stored size: 904 Bytes
Contents
module SimpleAdmin module Helpers module UrlHelper def resource_link(resource, method, namespace=:admin) singular_name = resource.class.model_name.element plural_name = singular_name.pluralize postfix = :path case method when :index resource_path = "#{namespace}_#{plural_name}_#{postfix}" when :new resource_path = "#{method}_#{namespace}_#{singular_name}_#{postfix}" when :create resource_path = "#{namespace}_#{plural_name}_#{postfix}" when :edit resource_path = "#{method}_#{namespace}_#{singular_name}_#{postfix}" when :update resource_path = "#{namespace}_#{singular_name}_#{postfix}" when :destroy resource_path = "#{namespace}_#{singular_name}_#{postfix}" end public_send(resource_path, resource) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems