Controllers and Models Models ControllersDB In stations_controller.rb (index): @stations = Station.all
Controllers and Models Models Controllers DB In stations_controller.rb (show):@stations = Station.find(params[:id])
Controllers and Models Models ControllersDB ActiveRecord::BaseMaps station model to stations table in database
The Rails Console1. Open the terminal2. Navigate to the firstfm directory3. Run the commands: rails console @stations = Station.all
The Rails Console rails console @stations = Station.all Task! Recreate the first line of the show action. 1. Create a hash with the key :id 2. Pass it into Station.find() Go toguides.rubyonrails.org/active_record_querying.html
The Rails Console Recreate the first line of the show action. 1. Create a hash with the key :id 2. Pass it into Station.find() Try out other AR methods:guides.rubyonrails.org/active_record_querying.html apidock.com/rails/ActiveRecord/Base
Task: Display a logo image on eachpage !1. Find and download an image to use asa logo2. Put it in firstfm/public/assets/3. Display it with the image_tag helper Search for image_tag on http://apidock.com/rails for reference!
Web BrowserHow does itall fit together? Rails Routing System Views ModelsDB Controllers