How do you access elements of one resource in another resource?
Let's say I have one resource called Restaurants that has several things a user adds to it. One of those things is a map.
When a user signs in, if I want to give them a recommendation of the day with the title of the restaurant and the map displayed somewhere on the page, how would I go about doing that? Let's say that the app is just going to go through the database and choose a place based on it's id number being one higher than it was yesterday, nothing special.
I think I would need to create another resource called DailyRecommendation or something. And then, in that controller, it would need to find the proper id so that it could display restuarant.title and restaurant.map, but I'm not sure how you do that. Is that even how you'd go about it? Thanks!
Posted about 5 years ago by