I am reading the RailsTutorial and it is like this:
in the routes.rb file we have added:
resources :users
- Then in the app/views/users/show.html.erb file we are using
@user - Then in app/controllers/users_controller.rb we can still use
@user - Then in app/views/users/show.html.erb again we can use
@user
So aren’t these all in different folders and classes? so @user is public? how do they see and work together? because I don’t have a deep knowledge of Rails this all looks like magic to me. If someone could shed some light on internals of what’s going on would be great.
The users in your question are not all the same: