Method: ActionDispatch::Routing::Mapper#mount_character_instance

Defined in:
lib/character/routing.rb

#mount_character_instance(name = 'admin') ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/character/routing.rb', line 3

def mount_character_instance(name='admin')
  scope "/#{ name }", :module => "character" do
    get   '/',       to: 'application#index'
    match '/login',  to: 'application#login',  via: [ :post, :get ]
    match '/logout', to: 'application#logout', via: [ :post, :get ]

    # settings api
    get  '/settings/:template_name(.:format)', to: 'settings#show'
    post '/settings/:template_name(.:format)', to: 'settings#update'

    # generic api
    get    '/:model_slug(.:format)',           to: 'api#index'
    get    '/:model_slug/new(.:format)',       to: 'api#new'
    get    '/:model_slug/:id(.:format)',       to: 'api#show'
    get    '/:model_slug/:id/edit(.:format)',  to: 'api#edit'
    match  '/:model_slug(.:format)',           to: 'api#create', via: [ :post, :put, :patch ]
    post   '/:model_slug/:id(.:format)',       to: 'api#update'

    # workaround for test environment, "patch" not working
    # Maxim
    patch  '/:model_slug/:id(.:format)',       to: 'api#patch'
    # Alex: I guess we need patch here
    #put  '/:model_slug/:id(.:format)',       to: 'api#patch'


    delete '/:model_slug/:id(.:format)',       to: 'api#destroy'
  end
end