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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:52:07+00:00 2026-05-11T17:52:07+00:00

Trying to use this method (gist of which is use self.method_name in the FunnyHelper

  • 0

Trying to use this method (gist of which is use self.method_name in the FunnyHelper, then call it as FunnyHelper.method_name in the view).

However this causes at least a couple of problems – view methods like h() and named routes get broken (they’re ok with the module method def method_name but not within any class method def self.method_name).

Obviously I can avoid this by dropping the def self.method_name back to def method_name; anyone with any suggestions for how I can have my cake and eat it too?

  • 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-11T17:52:07+00:00Added an answer on May 11, 2026 at 5:52 pm

    If you really want to do this, you can use

    include ActionController::UrlWriter
    

    to get access to your named routes and

    # h is a private method 
    ActionController::Base.helpers.send :h, "<"
    

    for other view helpers. But I would not recommend it. In my opinion the design pattern that thoughtobt is suggesting here sucks and I would just use helper :blogs despite their complaint that it isn’t explicit. That is true, sort of… but Rails in general and this part of Rails in particular is architected in a completely “non-explicit” way so trying to fight against that is going to be more trouble than it’s worth, as you are discovering.

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

Sidebar

Related Questions

I'm trying to use that method this way: public void Method() { ThreadPool.QueueUserWorkItem(() =>
Trying to use GridBagLayout. I have the method called buildLabel. This creates three label.
I'm trying to use depedency resolver inside a Web Api method. This worked fine
I am trying to use this UrlHelper extension method: public static string ToPublicUrl(this UrlHelper
Okay, I'm trying to use this method to get my data into R, but
I am trying to follow this JavaFX 2 guide: http://docs.oracle.com/javafx/2/ui_controls/table-view.htm#CJAGAAEE I use Scala instead
im trying to use this method to make my characters but i get the
im trying to use this method to make my characters but i get the
So i'm trying to use this method to load a certain theme based on
I'm trying to use this method but I get an error in Eclipse saying

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.