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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:08:52+00:00 2026-06-11T14:08:52+00:00

Actually, this is my problem. I have a rails app with a MainController, a

  • 0

Actually, this is my problem. I have a rails app with a MainController, a HttpHelper and a ServiceHelper.

main_controller.rb

class MainController < ApplicationController
    include ServiceHelper
    def my_method
        Service.make_stuff
    end
end

service_helper.rb

module ServiceHelper
    class Service
        include HttpHelper
        def self.make_stuff
            http__foo
        end
    end
end
Service = ServiceHelper::Service

http_helper.rb

module HttpHelper
    def http__foo
        #stuff
        params[:bar].nil?
    end
end

If everything work well, this code should tell me if the :bar param exist, but I have a problem. Firstly, this code doesn’t work, it tells me that http__foo is not defined, certainly because the include HttpHelper in Service doesn’t work.

My second probleme is that if the include works, there will probably be a problem with the params variable. If I call this method (http__foo) in the controller, it will be fine, but I call this from a subclass, then I’m not sure it’s be reliable.

  • 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-11T14:08:54+00:00Added an answer on June 11, 2026 at 2:08 pm

    make_stuff is a class method. http_foo is an instance method. Hence, when you call http__foo from your make_stuff, it is like calling Service.http_foo() which is not defined. What is defined is Service.new.http_foo().

    I don’t know what you want to do but in my humble opinion, by watching your code, it does not seem you are really familiar with Rails MVC concept and creating a MainController (why not use ApplicationController?), as well as the way you use your helpers is weird to me. It might be a good idea to restart from scratch.

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

Sidebar

Related Questions

I make the problem shorter. Actually I have data much longer than this. I
In my rails app, i have a create button as such def create @client
I never seemed to have this problem while doing Rails work in Linux, but
Premise This problem has a known solution (shown below actually), I'm just wondering if
Problem This question actually came up at work today. We are planning an experiment
This question is more about guidance than actually solving my problem: I need to
i have a very simple question, actually this is not the question, this is
I m Using a calendar.js file to implement calendar in my App. Actually this
In a Ruby on Rails app, say I have an Item and an Order
I have a problem with the normal way rails operates when using nested forms

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.