Module: CRUDtree::Interface::Helper

Defined in:
lib/crudtree/helper.rb

Instance Method Summary collapse

Instance Method Details

#resource(params, &resource_block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/crudtree/helper.rb', line 4

def resource(params, &resource_block)
  node(params) do
    collection(call: :index, rest: :get)
    collection(call: :new, rest: :get)
    collection(call: :create, rest: :post, path: "")
    member(call: :show, rest: :get)
    member(call: :edit, rest: :get)
    member(call: :update, rest: :put, path: "")
    member(call: :delete, rest: :get)
    member(call: :destroy, rest: :delete, path: "")
    eval(&resource_block) if resource_block
  end
end