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 7527941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:14:22+00:00 2026-05-30T04:14:22+00:00

I want to dynamically set the url path of a – application_path = @object.class.name.underscore

  • 0

I want to dynamically set the url path of a

  - application_path = @object.class.name.underscore + "_path"
  = link_to "<input type='button' value='Cancel' class ='bigbutton go_back'/>".html_safe, application_path(@application)

but i keep getting

 undefined method `application_path' for #<#<Class:0x00000103d11d80>:0x00000103d04a68>

any ideas on how to achieve this behavior

  • 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-05-30T04:14:24+00:00Added an answer on May 30, 2026 at 4:14 am

    In the general case, you can use Object#send to call a method based on a symbol (which you can get from a string using to_sym):

    send(application_path.to_sym, @application)
    

    From the docs:

    send(symbol [, args…]) → obj

    Invokes the method identified by symbol, passing it any arguments specified.

    But in this case, because your dynamic string is simple enough, Rails has a built-in method to do this, url_for:

    url_for(@application)
    

    Example from the docs:

    <%= url_for(@workshop) %>
    # calls @workshop.to_param which by default returns the id
    # => /workshops/5
    

    Note: this is assuming your @application is a model object where the route matches the model name. In your code there seems to be two instance variables, @object and @application, but you haven’t explained them fully, so you may need to modify the above to pass in @object instead of @application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to set a link in VB.net dynamically to a file. My url
I want to dynamically get the name of the current stored procedure inside itself
I want to dynamically create object of HtmlDivElement in my jsf managed bean and
I need to dynamically set values on a bunch or properties on an object,
I want to dynamically set the contentView in my activity. Because one time i
I want to dynamically set the height of an element .selected based on the
I want to dynamically hide/show some of the columns in a NSTableView, based on
I want to dynamically create controls in my bean. I am using JSF 2.0
I want to dynamically populate a link with the URI of the current request,
Suppose you want to dynamically add to a HTML menu, where the menu HTML

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.