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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:58:56+00:00 2026-05-22T17:58:56+00:00

If I have a ruby class which I want to use it as a

  • 0

If I have a ruby class which I want to use it as a library in a rails app, how (what folder) should I include it in the application?

I want to use the class in my controller. Do I just simply use ‘require’ to include the class?

  • 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-22T17:58:57+00:00Added an answer on May 22, 2026 at 5:58 pm

    You can just do a require in the controller assuming the file is somewhere in your load path. I follow a few simple strategies:

    1. If its a class that adds plugin like behavior but isnt quite large enough to write a plugin, I just put it in config/initializers since they the lib is in the load path and all the files are required for you on startup. No additional requires needed.

    2. The other option is to put them in the lib directory and just require them when you need them. If you are using rails 3, the lib directory is not a part of the load path and you will need to add it.

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

Sidebar

Related Questions

I have a Date class which I would like to use to overwrite Ruby's
I have a Rails Model: ruby-1.9.2-p0 > NavItem => NavItem(id: integer, item_identifier: string, description:
I have a class where I want 'each' to yield another custom object, so
I have a class called Note , which includes an instance variable called time_spent
I want to keep track of all the methods which have been run on
I am beginning Rails programming and all I want to accomplish is to have
I am a big fan of doxygen which I have used for years with
I think I've found something which C# and Ruby can do but Python can
I tried to extend an existing Singleton class in Ruby, as an example the
I have an Invoice model which belongs to Customer (and of course Customer has_many

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.