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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:48:07+00:00 2026-05-26T09:48:07+00:00

Regarding the use of Rails console, when I make some change on a model,

  • 0

Regarding the use of Rails console, when I make some change on a model, do I need to reload the rails console every time to make that change reflects?

For example, I have my original code as follows:

class Article < ActiveRecord::Base
  validates :title, :presence => true
  validates :body, :presence => true
end

Later, I want to add some additional attribute as below.

class Article < ActiveRecord::Base
  validates :title, :presence => true
  validates :body, :presence => true

  def long_title
    "#{title} - #{published_at}"
  end
end

Does it need to run the command “reload!” every time to be able to do the “long_title” method call? Otherwise, I will get an error saying as the attribute hasn’t been defined. and Why do we need to perform that manually?

  • 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-26T09:48:07+00:00Added an answer on May 26, 2026 at 9:48 am

    Yes, you need to call reload! as this will clear the loaded constants that have been loaded and will load them as they’re referenced in the console.

    If you have old objects from before the reload! you will need to call reload on these individual objects or find new objects and work with them if you want to try out the new method.

    As an alternative, I would really recommend looking into a testing framework such as RSpec which gives you repeatable tests and a safety net for your application.

    It looks like you’re trying to use the console as a testing tool for new functionality in your application, which is what RSpec is better suited for. The console is really good for experimentation.

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

Sidebar

Related Questions

I have seen coffescript tutorials that show how to use coffeescript with rails, nodejs,
I have a question regarding Ruby on Rails. I'm currently use a gem called
So I'm finally ready to allow some friends to use my Ruby on Rails
I have a question regarding use of FFT. Using function getBand(int i) with Minim
I have question regarding the use of function parameters. In the past I have
I have a very general question regarding the use of LINQ vs SQL to
I was wondering if there is a standard practice regarding the use of labels
I would like to ask couple of Questions regarding the use of Monitor Class
I have the doubt regarding when to use the Dispatcher.Invoke to update something on
I have a question regarding VB.net and the use of rsData connections to an

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.