Skip to content

Commit

Permalink
Correct relations in examples for counterCache
Browse files Browse the repository at this point in the history
  • Loading branch information
ankr committed Sep 13, 2012
1 parent 8592b6c commit 6f4f120
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions en/models/associations-linking-models-together.rst
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,9 @@ counter-cache in your association by adding a ``counterCache`` key
and set the value to ``true``::

<?php
class Image extends AppModel {
class ImageComment extends AppModel {
public $belongsTo = array(
'ImageComment' => array(
'Image' => array(
'counterCache' => true,
)
);
Expand All @@ -555,9 +555,9 @@ to, depending on how you look at it) the counter value.
Using our Image model example, we can specify it like so::

<?php
class Image extends AppModel {
class ImageComment extends AppModel {
public $belongsTo = array(
'ImageComment' => array(
'Image' => array(
'counterCache' => true,
'counterScope' => array('Image.active' => 1) // only count if "Image" is active = 1
)
Expand Down
8 changes: 4 additions & 4 deletions fr/models/associations-linking-models-together.rst
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,9 @@ counter-cache in your association by adding a ``counterCache`` key
and set the value to ``true``::

<?php
class Image extends AppModel {
class ImageComment extends AppModel {
public $belongsTo = array(
'ImageComment' => array(
'Image' => array(
'counterCache' => true,
)
);
Expand All @@ -561,9 +561,9 @@ to, depending on how you look at it) the counter value.
Using our Image model example, we can specify it like so::

<?php
class Image extends AppModel {
class ImageComment extends AppModel {
public $belongsTo = array(
'ImageComment' => array(
'Image' => array(
'counterCache' => true,
'counterScope' => array('Image.active' => 1) // only count if "Image" is active = 1
)
Expand Down
8 changes: 4 additions & 4 deletions ja/models/associations-linking-models-together.rst
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,9 @@ counter-cache機能を有効にするためにアソシエーションの設定
``counterCache`` キーに ``true`` をセットしましょう。 ::

<?php
class Image extends AppModel {
class ImageComment extends AppModel {
public $belongsTo = array(
'ImageComment' => array(
'Image' => array(
'counterCache' => true,
)
);
Expand All @@ -532,9 +532,9 @@ counter-cache機能を有効にするためにアソシエーションの設定
Imageモデルのサンプルでは、次のようになるでしょう。 ::

<?php
class Image extends AppModel {
class ImageComment extends AppModel {
public $belongsTo = array(
'ImageComment' => array(
'Image' => array(
'counterCache' => true,
'counterScope' => array('Image.active' => 1) // "Image" が active なデータのみカウントします
)
Expand Down

0 comments on commit 6f4f120

Please sign in to comment.