Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/cable/rails/routes.rb
Instance Method Summary collapse
-
#cable_to(*resources, &block) ⇒ Object
Is equivelant to namespace :admin do resource :product end.
Instance Method Details
#cable_to(*resources, &block) ⇒ Object
Is equivelant to
namespace :admin do
resource :product
end
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/cable/rails/routes.rb', line 12 def cable_to(*resources, &block) = resources. path = "admin" admin_namespace = { :path => path, :as => path, :module => path, :shallow_path => path, :shallow_prefix => path } scope(admin_namespace) do if apply_common_behavior_for(:resources, resources, , &block) return self end resource_scope(Resource.new(resources.pop, )) do yield if block_given? collection do get :index if parent_resource.actions.include?(:index) post :create if parent_resource.actions.include?(:create) end new do get :new end if parent_resource.actions.include?(:new) member do get :edit if parent_resource.actions.include?(:edit) get :show if parent_resource.actions.include?(:show) put :update if parent_resource.actions.include?(:update) delete :destroy if parent_resource.actions.include?(:destroy) end end end self end |