Don’t use Rails console sandbox in production

user1 = User.first
mp1 = Micropost.first
user1.micropost = mp1
user1.save
user1.micropost #=> prints the mp1 instance object
rails console --sandbox
Loading development environment in sandbox (Rails 7.0.2.2)
Any modifications you make will be rolled back on exit

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store