From a44f613c5f32ec5da174198dd841f122efe64f95 Mon Sep 17 00:00:00 2001 From: James Miller Date: Fri, 6 Feb 2009 07:51:11 -0800 Subject: Fix some spelling erros in Active Record Querying guide --- railties/guides/source/active_record_querying.textile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/guides/source/active_record_querying.textile') diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index ffffecace3..99cf2affd8 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -294,7 +294,7 @@ Be careful because this also means you're initializing a model object with only ActiveRecord::MissingAttributeError: missing attribute: -Where is the atrribute you asked for. The +id+ method will not raise the +ActiveRecord::MissingAttributeError+, so just be careful when working with associations because they need the +id+ method to function properly. +Where is the attribute you asked for. The +id+ method will not raise the +ActiveRecord::MissingAttributeError+, so just be careful when working with associations because they need the +id+ method to function properly. You can also call SQL functions within the select option. For example, if you would like to only grab a single record per unique value in a certain field by using the +DISTINCT+ function you can do it like this: +Client.all(:select => "DISTINCT(name)")+. @@ -413,7 +413,7 @@ If you wanted to find the address and mailing address for that client you would mailing_addresses.client_id = client.id -This query is more efficent, but there's a gotcha: if you have a client who does not have an address or a mailing address they will not be returned in this query at all. If you have any association as an optional association, you may want to use include rather than joins. Alternatively, you can use a SQL join clause to specify exactly the join you need (Rails always assumes an inner join): +This query is more efficient, but there's a gotcha: if you have a client who does not have an address or a mailing address they will not be returned in this query at all. If you have any association as an optional association, you may want to use include rather than joins. Alternatively, you can use a SQL join clause to specify exactly the join you need (Rails always assumes an inner join): Client.all(:joins => “LEFT OUTER JOIN addresses ON @@ -555,7 +555,7 @@ This method, called as +Client.active_within_2_weeks.all+, will return all clien h4. Arguments to Named Scopes -If you want to pass to a named scope a required arugment, just specify it as a block argument like this: +If you want to pass to a named scope a required argument, just specify it as a block argument like this: class Client < ActiveRecord::Base -- cgit v1.2.3