Databases are not built-in to Sinatra by default. However, it is easy to add database connectivity by adding additional RubyGems. Learn the fundamentals and configuration you would need to get started.
- [Instructor] In this movie, I want us to talk…about how we could use databases in a Sinatra project.…Remember Sinatra is designed to be as lean as possible,…and that means that all extra code…has been left out of it by default.…Sinatra does not include code to allow us…to connect to databases automatically.…If we want to connect to a database, then we have to add in…a code library that will allow us to do that.…There are three main code libraries…that I think you should consider,…ActiveRecord, Sequel, and DataMapper,…and all three have their fans and supporters.…
Therefore, if you know Ruby On Rails, you'll know how…to work with ActiveRecord already in Sinatra.…And because Ruby On Rails has a very large audience,…it means that it's probably the most popular choice…for using with Sinatra as well.…Some people like using Sequel and DataMapper…because they are lighter weight than ActiveRecord.…They don't have the full set of features…that ActiveRecord has.…For our purposes, I'm going to walk you through…how you would use ActiveRecord, but the process…
- Installing Sinatra
- Launching the server
- Defining routes
- Using route patterns and parameters
- Redirecting requests
- Rendering dynamic templates
- Using partial templates and layouts
- Defining custom helpers
Skill Level Intermediate
Ruby on Rails 5 Essential Trainingwith Kevin Skoglund10h 21m Beginner
Ruby on Rails: Get More From ActiveRecordwith Kevin Skoglund4h 27m Intermediate
3. Helpers and Filters
4. Useful Techniques
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.