Rails Console: Reboot! does not reflect changes in model files? What could be the reason?

It used to work fine. I played a little configuration. So maybe I changed some configuration unconsciously.

here is config environment / development.rb

config.cache_classes = false # Log error messages when you accidentally call methods on nil. config.whiny_nils = true # Show full error reports and disable caching config.consider_all_requests_local = true config.action_view.debug_rjs = true config.action_controller.perform_caching = false # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger config.active_support.deprecation = :log # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin # migration prefix with sequence #s config.active_record.timestamped_migrations = false #time zone config.time_zone = 'UTC' 

Here is the .rb application configuration section

  # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] config.active_record.schema_format = :sql 

when i start reboot! on rails console it return true

+82
ruby ruby-on-rails reload config rails-console
Mar 25 '11 at 1:30
source share
2 answers

reload! only reloads the latest code in the console environment. It does not reinitialize existing objects.

This means that if you have already created any objects, their attributes will not be updated. However, if you create a new object, its attributes will reflect the reloaded code. more details here

+140
Mar 25 2018-11-11T00:
source share

Are you reloading an object from the database?

For example:

 >> a = User.last => #<User id: 16, email: "asdfadsf@sdfdsf.com"> >> reload! Reloading... => true 

'a' will not reflect any changes to your model until you reload it from db.

+15
Mar 25 '11 at 4:00
source share



All Articles