Test Your Knowledge
Quiz
How can you sanitize information being passed to a SQL query so it canât harm your database?
Whatâs the simplest way to keep user-entered data from attacking other usersâ browsers?
How does switching to production mode affect caching?
Where do you make changes to Railsâ production database configuration?
Answers
Specifying the
:conditions
parameter as an array makes Rails take a closer look at incoming data to ensure that isnât potentially damaging SQL.Applying the
h
method to all outgoing content is the simplest way to ensure that nothing awful gets through, though stripping all HTML tags is another similarly effective option.Rails caches heavily in production mode, helping you to maximize throughput while minimizing processing time.
The config/database.yml file is the place to specify database information, including the type of database, where to connect to the database, and any authentication information.
Get Learning Rails: Live Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.