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?