<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>tests/cases/behaviors/named_scope.test.php</filename>
    </added>
    <added>
      <filename>tests/fixtures/user_fixture.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -56,7 +56,13 @@ class NamedScopeBehavior extends ModelBehavior
      */
     function setup($model, $settings = array())
     {
+        $settings = (array)$settings;
         foreach ($settings as $named =&gt; $options) {
+            if (!is_array($options)) {
+                unset($settings[$named]);
+                $settings[$options] = array();
+                $named = $options;
+            }
             $model-&gt;_findMethods[$named] = true;
             $this-&gt;mapMethods['/find' . $named . '/'] = '_findScoped';
             $this-&gt;mapMethods['/' . $named . '/'] = '_methodScoped';
@@ -80,8 +86,7 @@ class NamedScopeBehavior extends ModelBehavior
     {
         if ($state == 'before') {        
             preg_match('/^_find(\w+)/', $method, $matches);
-            $params = array_merge($params, $this-&gt;_settings[$model-&gt;alias][$matches[1]]);
-            return $params;
+            return $this-&gt;_mergeParams($model, $params, $matches[1]);
         } elseif ($state == 'after') {
 			return $results;
         }
@@ -102,8 +107,32 @@ class NamedScopeBehavior extends ModelBehavior
 			$conditions = 'first';
 			$fields = array_merge(compact('conditions', 'fields', 'order', 'recursive'), array('limit' =&gt; 1));
 		}
-        $fields = Set::merge($fields, $this-&gt;_settings[$model-&gt;alias][$method]);
+        $fields = $this-&gt;_mergeParams($model, $fields, $method);
         return $model-&gt;dispatchMethod('find', array($conditions, $fields));
     }
+    
+    /**
+     * Merges params, to ensure that all required params are set. The params passed to the find call
+     * always take precedence, over those set in the behavior settings.
+     * 
+     * @param object $model The model object
+     * @param array $params The params passed to the find call
+     * @param string $method Method name called
+     * 
+     * @return array Merged params
+     */
+    function _mergeParams($model, $params, $method)
+    {
+        foreach ($this-&gt;_settings[$model-&gt;alias][$method] as $key =&gt; $value) {
+            if (is_array($value)) {
+                $params[$key] = isset($params[$key]) ? Set::merge($params[$key], $value) : $value;
+            } else {
+                if (!isset($params[$key]) || empty($params[$key])) {
+                    $params[$key] = $value;
+                }
+            }
+        }
+        return $params;
+    }
   
 }
\ No newline at end of file</diff>
      <filename>models/behaviors/named_scope.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b47e365cd84dfdf036ca7d688772dfa0eddb6a34</id>
    </parent>
  </parents>
  <author>
    <name>Joel Moss</name>
    <email>joel@developwithstyle.com</email>
  </author>
  <url>http://github.com/joelmoss/cakephp-namedscope/commit/a06daa9ac070caec6759b38dc36bb6737bdeb00d</url>
  <id>a06daa9ac070caec6759b38dc36bb6737bdeb00d</id>
  <committed-date>2008-12-11T04:44:12-08:00</committed-date>
  <authored-date>2008-12-11T04:44:12-08:00</authored-date>
  <message>Created test cases, and corrected behaviour of param merges, so that find call params always take precedence.</message>
  <tree>92a72916ed470c9b14c1c2b91bc1411e4374105b</tree>
  <committer>
    <name>Joel Moss</name>
    <email>joel@developwithstyle.com</email>
  </committer>
</commit>
