Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8250047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:45:29+00:00 2026-06-07T23:45:29+00:00

I am wondering if there is a way to extend the existing path helpers

  • 0

I am wondering if there is a way to extend the existing path helpers that Rails created for my routes.

I have something like /videos/view/:id already and now I need to append a tag parameter to that link wherever it (from the current params collection).

The only solution I see right now is to go through all the views and change the call to the helper to look like this:

view_videos_path(video, tag: params[:tag])

Now obviously that’s a bit of work and a much easier way to do this would be to just overwrite the existing path helper with something like this:

def view_videos_path(video, opts)
  view_videos_path(video, opts.merge(tag: params[:tag]))
end

Obviously putting this in a module would result in a endless recursion so I wonder if there is any best practice on how to do this.

Also, what do you think of the approach? I am not really sure if extending the helper like this is wise or not. But to me at the moment it looks reasonable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:45:32+00:00Added an answer on June 7, 2026 at 11:45 pm

    Throw them in a helper module and call super, you can also include it into ApplicationController so the paths are also available in your controllers:

    # app/helpers/path_helpers.rb
    module PathHelpers
      def view_videos_path(video, opts)
        super(video, opts.merge(tag: params[:tag]))
      end
    end
    
    class ApplicationController
      include PathHelpers # we could also use helper_method for each method
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if there is a way to extend build explorer that displays
I was wondering is there a way in PHP that you could tell where
Wondering if there is any way to get the lambda expressions that result from
Wondering if there is a way I could trigger an event, so that any
I'm wondering if there's any relatively easy way to extend NHibernate to support F#'s
I'm wondering whether there's a way to extend the BaseDaoImpl class of ORMLite on
I was wondering if there was an easy way to extend Git commands. So
Just wondering is there any way I can check whether the url links to
I was wondering is there a way to give the user a small guided
I was wondering is there a way in visual studio 2010 to search in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.