I am new to rails and have a very simple scenario like mentioned here
In the photos model i said it belongs_to :user
When I access the photos.all, I can get the user email by
If I want to display 100 photos on a page, the email is accessed as
above it goes to the database at that time to get the value
1) Am I violating MVC here as the database query is being sent (though
not by me directly) in the view?
2) Since the query goes 100 times in the view, should there be a
better way to get all the data at once in the controller/model and
pass all that to the view.
I am coming from PHP world where I used to write queries and there I
used to do a join on photos table and got all the data at once. Is
this join costlier than getting data in each query as above