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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:51:21+00:00 2026-05-26T14:51:21+00:00

I have written constant.rb in lib/ folder for my rails app.To use that in

  • 0

I have written constant.rb in lib/ folder for my rails app.To use that in ActiveRecord, I have written ActiveRecord::Base.extends Constant in constant.rb and it is working. But I don’t know how to use the same in ActionController, I tried ActionController::Base.extends Constant But It is not worked. Pls help.

  • 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-26T14:51:22+00:00Added an answer on May 26, 2026 at 2:51 pm

    it’s typo… you wrote the plural but actually it’s singular extend.

    A few tips:

    • Constant may not be a good name for your Module maybe call more specific like AppConstant.

    • You shouldn’t put this into your lib/constant.rb, it’s cleaner to create a new initializer like

    config/initializers/constants.rb

    require 'app_constant'
    ActiveRecord::Base.extend AppConstant
    ActiveController::Base.extend AppConstant
    

    maybe there’s an even better way: put the extend AppConstant into your app/controllers/application_controller.rb

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

Sidebar

Related Questions

I need to use a class that I have written as the type of
I have written a function that sorts a big scale of data. To test
I have written a function that extract the domain from hostname. e.g. www.domain.com ->
I have written a very simple CTE expression that retrieves a list of all
I have written a custom credit card validation attribute that checks CardNumber property is
I have a program (written in C/C++) that behaves as a socket server. I'd
My problem is this: I have a C/C++ app that runs under Linux, and
I have written a function that converts a decimal number to a binary number.
I have a file with saved data that sometimes needs to be accessed, written
I have written a class that will be used to store parameters in a

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.