Rails Fundamentals Session Two
Rails Fundamentals Session Two
Routes
rake routes
Referencing URLs with names and helpers
special routes
root_path
Relationships
Once you add a relationship, Rails will figure out routes and lets you access the related models
For example:
- add a
belongs_to
relationship in theanswer
model. Now you can use the relationsquestion.answers.create ...
- Once you set up the relationships, Rails will also figure out the route
redirect_to question
Session
- A session is a place to store data during one request that you can read during later requests.
- Only available in the controller and the view
- Cookie by default, overridable
- Useful for Authentication, or anything that requires passing information around between requests
- If you’re curious about how sessions are implemented in rails, they are referenced here
- Information on How Session is implemented in Rails Action Controller Session
Action Mailer
Action Mailer allows you to send emails from your application using mailer classes and views.
rails generate mailer UserMailer
- inherit from ActionMailer::Base, where you can define mailer to, from, and subject
- offers a Mailer View, where you can customize the HTML body of your email
Next Class
- Wrap up ActionMailer and Test Driven Development continued
- Active Job
- Asset Pipeline
- Deployment
- Debugging for Self Reliance
- Nominate a specific topic to go in depth