ruby - How to dynamically transmit params in link_to ? -


i need use part of application in iframe on page. need remove layout on these pages.

i added applicationcontroller

layout :current_layout def current_layout   if params[:layout] == false.to_s     false   else     'main'   end end 

this works until user click on link in navigation. need add every link_to in part of application like:

link_to 'store', store_path(params.merge({layout: params[:layout]}) 

i wondering maybe can refactor , maybe remove params.merge every link?

you try this:

def my_path_helper(string, path_type, params)   link_to(string, polymorphic_path([path_type], params.merge({layout: params[:layout]}))) end 

see the docs polymorphic path here , answer provides example.

is looking for?


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -