Welcome to the Treehouse Community
Looking to learn something new?
Shawn WilsoniOS Development Techdegree Student 7,049 Points
Creating a custom view to display multiple tables.
Hey guys so I'm wondering if this is possible in sure it is but I seem stuck here. So I want to build a view eg index.html.erb. In this view I want to pull data from several tables. Is this as simple as just doing the following in the controller for said view?
Def index @sites = Site.all Ect @residents = Resident.all End
And then the Sam if I wanted to tie a particular table say a vehicle that belongs to a resident below the resident?
Maciej Czuchnowski36,440 Points
Basically yeah, you can create any instance variables you want in the controller's action and put any stuff inside them and then iterate over them in the view wherever you want.