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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:34:43+00:00 2026-06-11T02:34:43+00:00

I am building an application with Ruby 1.9.3 and Rails 3.0.9 I have a

  • 0

I am building an application with Ruby 1.9.3 and Rails 3.0.9

I have a class like below.

module CDA
  class Document
    def humanize_class_name
      self.class.name.gsub("::","")
    end
  end
end

I want the class name like “CDADocument”.

Is my humanize_class_name method is the correct way to achieve this?

OR

Any other built in methods available with Rails?

  • 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-11T02:34:44+00:00Added an answer on June 11, 2026 at 2:34 am

    I think Rails might have something similar, but since the form you want is peculiar, you will have to design the method by yourself. The position where you define it is wrong. You would have to do that for each class. Instead, you should define it in Class class.

    class Class
        def humanize_class_name
          name.delete(":")
        end
    end
    some_instance.class.humanize_class_name #=> the string you want
    

    or

    class Object
        def humanize_class_name
            self.class.name.delete(":")
        end
    end
    some_instance.humanize_class_name #=> the string you want
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a Ruby on Rails application and I want to be able
I have the Ruby on Rails-based application Redmine (based on the BitNami redmine package)
I am building an application in Cocoa that uses a local Ruby on Rails
What is the recommended approach building a plugin API for a ruby (rails) application?
I am building an application using Ruby on Rails. I want to do something
I'm building a web application with Ruby on Rails which needs to be highly
I'm building an iPhone application that talks to a Ruby on Rails backend. The
I have a ruby on rails 3.0 application which will need a database containing
I am building web applications using Ruby on Rails and I would like to
I have a website built by someone else with ruby-on-rails, and I'm now building

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.