Module: ActionDispatch::Routing::Mapper::Resources

Defined in:
lib/core_ext/resources.rb

Instance Method Summary collapse

Instance Method Details

#edgarj_popup_resources(*symbols, &block) ⇒ Object

define edgarj specific routing for popup.

Following declaration in config/routes.rb:

edgarj_popup_resources :photos_popup

creates the following routes in your application, all mapping to the Photos controller which inherits from Edgarj::PopupController:

GET       /photos_popup/index
GET       /photos_popup/search
PATCH/PUT /photos_popup/:id/page_info_save

Where, :id is internally used for session so that client application doesn’t have to take care it.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/core_ext/resources.rb', line 61

def edgarj_popup_resources(*symbols, &block)
  resources(*symbols, only: [:index]) do
    yield if block_given?

    collection do
      get :search
    end

    member do
      put :page_info_save
    end
  end

  self
end

#edgarj_resources(*symbols, &block) ⇒ Object

define edgarj specific routing for CRUD.

Following declaration in config/routes.rb:

edgarj_resources :photos

creates the following routes in addition to the default routes in your application, all mapping to the Photos controller which inherits from Edgarj::EdgarjController:

GET       /photos/clear
GET       /photos/csv_download
GET       /photos/search
GET       /photos/search_clear
GET       /photos/zip_complete
PATCH/PUT /photos/:id/page_info_save

Where, :id is internally used for session so that client application doesn’t have to take care it.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/core_ext/resources.rb', line 22

def edgarj_resources(*symbols, &block)
  resources(*symbols) do
    yield if block_given?

    collection do
      get :clear
      get :csv_download
      get :search
      get :search_clear
     #get :search_save
     #get :search_load
      get :zip_complete
    end

    member do
      put   :page_info_save
      patch :page_info_save
    end
  end

  self
end