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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:19:08+00:00 2026-05-10T23:19:08+00:00

Reading source code of sample projects, such as Beast and Bort, are recommended as

  • 0

Reading source code of sample projects, such as Beast and Bort, are recommended as a good way to learn rails. But I found myself getting lost in reading source code of these projects, cause the included plugins might bring in some strange code without any hint, such as 'require' or 'include'. Could you share your rails code reading experience? Lots of thanks ahead.

  • 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. 2026-05-10T23:19:08+00:00Added an answer on May 10, 2026 at 11:19 pm

    When learning to use rails, one of the most important things to know is how it loads the code you’ve written. Let’s say you have a HelloController in the app/controllers/demo/sub directory. If you generated this controller, it will have the correct name of Demo::Sub::HelloController.

    When your route tells rails to look for ‘demo/sub/hello’, that is translated into the controller’s full name (Demo::Sub::HelloController) which rails will they try to call. Ruby cannot find this class and calls const_missing which makes rails translate the name into a file, in this case demo/sub/hello_controller (:: = /, capitals other than first = _, look for Inflections under underscore method). Rails then requires this file and checks for the correct class definition.

    Rails adds several directories into the ruby’s load path (app/controllers, app/models, app/helpers, lib, vendor) and a demo/sub/hello_controller.rb in any of these directories will satisfy the require. But controllers not in app/controllers will need special care for there views.

    Also, this works for the namespaces, only it will look for a directory. So referencing Demo::Sub will look for the demo/sub directory. This allows you to forgo the standard definition of classes, so you can do

    class Demo::Sub::HelloController < ActionController::Base  end 

    instead of

    module Demo   module Sub     class HelloController < ActionController::Base      end   end end 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In theory, it should be the same as for an… May 11, 2026 at 11:38 pm
  • Editorial Team
    Editorial Team added an answer A shorter shell version: xargs -n1 < input.txt | sort… May 11, 2026 at 11:38 pm
  • Editorial Team
    Editorial Team added an answer By using the OR operator when creating your file handle,… May 11, 2026 at 11:38 pm

Related Questions

I am considering writing a simple database application for my wife, but I'm hung
As of late, my team and I have been hard at work turning our
I need some mind reading here, since I am trying to do what I
I'm evaluating the possibility of developing an Eclipse plugin to modify the source code

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.