Sha256: a41fdf4cc6897e31f6686036fcde5686ae9fdd76e721d061264627f208ccc18f
Contents?: true
Size: 978 Bytes
Versions: 249
Compression:
Stored size: 978 Bytes
Contents
module Katello module Routing module MapperExtensions def api_resources(*args, &block) options = args.extract_options! options[:except] = Array(options[:except]) options[:except].push(:new, :edit) args << options resources(*args, &block) end def api_attachable_resources(resource_plural_name, options = {}) resource_singular_name = options.try(:delete, :resource_name) resource_singular_name ||= resource_plural_name.to_s.singularize controller = options.delete(:controller) api_resources resource_plural_name, :controller => controller, :only => [] do params = { :on => :collection, :action => "add_" + resource_singular_name.to_s } post :index, params.merge(options) params = { :on => :member, :action => "remove_" + resource_singular_name.to_s } delete :destroy, params.merge(options) end end end end end
Version data entries
249 entries across 249 versions & 1 rubygems