Active Record object reloads and reloads !?

What is the difference between active record object reload and send(:reload!) .

 self.reload # fetches object attributes from db and modifies current self.send(:reload!) # doing same ? 

How to get db object without actually changing the current instance using reload?

I can do it using

 self.class.find self.id 

Is there another way?

+4
source share
1 answer

from the document:

 reload!(print=true) reloads the environment reload() Forces reloading of relation. 

I think restart! is a global feature for ribs to reload the environment, not sure what will happen in non-interactive Rails VM ...

0
source

Source: https://habr.com/ru/post/1402211/


All Articles