0

I am trying to call an action from a controller 2 steps up the folder structure namespace

<%= link_to( "Reset Search" ,
             {:controller => "../../application",
              :action => 'reset_search',
              :reset_search_redirect => reset_search_redirect},
             class: 'tiny button') %>

The "../../application"works! however; i dont think it's rails-y. Is there a better way?

Here is the href link when I just put :controller => "application"

/human_resources/settings/application/reset_search?reset_search_redirect=%2Fhuman_resources%2Fsettings

Which does not work.

Here are my routes:

get 'human_resources/' => 'human_resources#index'
namespace :human_resources do
  get 'settings/' => 'settings#index'
  namespace :settings do
    get 'constants/' => 'constants#index'
    resources :constants
  end
end

resources :test, only: :index
root to: 'home#index'
match ':controller(/:action(/:id))', :via => [:get, :post]
Gupta
  • 8,882
  • 4
  • 49
  • 59
james
  • 515
  • 4
  • 14
  • 1
    Possible duplicate of [rails using link\_to with namespaced routes](http://stackoverflow.com/questions/4269884/rails-using-link-to-with-namespaced-routes) – Pardeep Dhingra Dec 30 '15 at 10:01
  • 1
    you can see commands for your routes with `rake routes` command. Then you can use that + path in your `link_to` tags (possibly `application_reset_search_path` in your case) – Kkulikovskis Dec 30 '15 at 11:59

0 Answers0