Browse files

minor doc fix.

  • Loading branch information...
1 parent f30227a commit fe517e04d3770acf575a0497b6530f20b8a34859 qiang.xue committed May 8, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 docs/guide/
@@ -555,7 +555,7 @@ $posts=Post::model()->published()->recently()->findAll();
In general, named scopes must appear to the left of a `find` method call. Each of them provides a query criteria, which is combined with other criterias, including the one passed to the `find` method call. The net effect is like adding a list of filters to a query.
-===Parameterized Named Scopes
+### Parameterized Named Scopes
Named scopes can be parameterized. For example, we may want to customize the number of posts specified by the `recently` named scope. To do so, instead of declaring the named scope in the [CActiveRecord::scopes] method, we need to define a new method whose name is the same as the scope name:
@@ -581,7 +581,7 @@ $posts=Post::model()->published()->recently(3)->findAll();
If we do not supply the parameter 3 in the above, we would retrieve the 5 recently published posts by default.
-===Default Named Scope
+### Default Named Scope
A model class can have a default named scope that would be applied for all queries (including relational ones) about the model. For example, a website supporting multiple languages may only want to display contents that are in the language the current user specifies. Because there may be many queries about the site contents, we can define a default named scope to solve this problem. To do so, we override the [CActiveRecord::defaultScope] method as follows,

0 comments on commit fe517e0

Please sign in to comment.