Rails.application.routes.draw do namespace :panel do namespace :er_email do namespace :back_end do match 'public' => "er_emails#public",:as => :public match 'approval_setting' => "approvals#setting" ,:as => :approval_setting,:via => :get match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put resources :email_ers do match "approve/:email_er_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put match "approve/:email_er_id" => "approvals#approve",:as => :approve,:via => :post collection do post "preview" put "preview" get 'delete' get 'email_resend' get 'test_send_email' end end resources :email_er_categorys do collection do get 'get_categorys_json' end # if want to use json # please uncommand below line # match "get_email_ers_json/" => "email_er_categorys#get_email_ers_json", :as => :get_email_ers_json end end end end end