Your are here: Home // Posts Tagged With database
025 RC Eager Loading
Podcast: Play in new window
| Download
Eager loading is a terrific way of speeding up your response times. Let’s consider a piece of code that pulls a list of associated objects from the database. For example, a view that displays the posts written by a given user:
<% @user.posts.each do |post| %>
<%= render post %>
<% end %>
(I know that partial has a collection option...
Tags: database, eager loading
Convention over Configuration
Podcast: Play in new window
| Download
The idea behind convention over configuration is that rather than having several or one large configuration file to set up the framework for you to use, Rails uses conventions to determine how things should work without configuration. In many cases in Rails, there are ways to override the default convention, but most people stick to the conventions.
The conventions...
008 RC ActiveRecord Migration Gotchas
Podcast: Play in new window
| Download
Rails Migrations are generally pretty straightforward, but there are a few things that people do that wind up giving them headaches later on.
First, don’t change migrations once they’ve been committed or deployed. This causes problems because ActiveRecord tracks migrations that have already been run. So, editing a migration that’s already...
006 RC Ruby on Rails Authentication Basics
Podcast: Play in new window
| Download
In a lot of web applications, you need to control who can access your data. Authentication is the key to this type of security. Ruby on Rails has some plugins and gems that make authentication pretty easy. Here are a few:
restful-authentication
authlogic
devise
When putting authentication together, make sure that your authentication schema provides encryption...
Tags: authentication, authlogic, database, devise, encryption, password, rails, restful_authentication, ruby, ruby on rails, salt, ssl
003 RC Single Table Inheritance (STI)
Podcast: Play in new window
| Download
Single Table Inheritance is a slightly advanced topic in Ruby on Rails. It stems from class inheritance, which is a core Object Oriented Programming principle.
In Ruby, if you inherit one class from another, you use the ‘<’ operator. Here’s an example:
class Truck < Car
end
In Rails, this gets tricky because when inheriting a Model,...

