<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -158,6 +158,15 @@ class PostsController extends AppController {
              // Delete all post categories
              $this-&gt;Post-&gt;query(&quot;DELETE FROM categories_posts WHERE post_id = {$this-&gt;Post-&gt;id}&quot;);
         }
+        
+        // Assigning a new category?
+        if (isset($this-&gt;data['_assign_category'])) {
+            $result = $this-&gt;Post-&gt;CategoriesPost-&gt;save(array(
+                'post_id' =&gt; $this-&gt;data[$this-&gt;modelClass]['id'],
+                'category_id' =&gt; $this-&gt;data[$this-&gt;modelClass]['assign_category_id'],
+            ));
+            fb($result);
+        }
 
         if (!$this-&gt;Post-&gt;save()) return $this-&gt;cakeError('save_error'); // @TODO Rendering the exact save errors would be better
 </diff>
      <filename>wildflower/controllers/posts_controller.php</filename>
    </modified>
    <modified>
      <diff>@@ -50,8 +50,8 @@
         
         &lt;div id=&quot;assign_category_box&quot;&gt;
         &lt;?php 
-            echo $form-&gt;input('category_id', array('type' =&gt; 'select', 'options' =&gt; $categories, 'label' =&gt; false, 'empty' =&gt; __('select a category...', true), 'value' =&gt; $categoryId)); 
-            echo $form-&gt;submit('Assign', array('name' =&gt; 'assign_category'));
+            echo $form-&gt;input('assign_category_id', array('type' =&gt; 'select', 'options' =&gt; $categories, 'label' =&gt; false, 'empty' =&gt; __('select a category...', true), 'value' =&gt; $categoryId)); 
+            echo $form-&gt;submit('Assign', array('name' =&gt; 'data[_assign_category]'));
         ?&gt;   
         &lt;/div&gt;
 </diff>
      <filename>wildflower/views/posts/admin_edit.ctp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7c380c5d045f24f1b87f2a181b2301929b5621f5</id>
    </parent>
  </parents>
  <author>
    <name>klevo</name>
    <email>klevo@klevo.sk</email>
  </author>
  <url>http://github.com/klevo/wildflower/commit/96a8263a93348b335d3340c3a82edcdbaf0e5502</url>
  <id>96a8263a93348b335d3340c3a82edcdbaf0e5502</id>
  <committed-date>2009-10-20T07:29:55-07:00</committed-date>
  <authored-date>2009-10-20T07:29:55-07:00</authored-date>
  <message>Save logic</message>
  <tree>556e00277f7d8a26bfc2620b0d1f2d4adb8af064</tree>
  <committer>
    <name>klevo</name>
    <email>klevo@klevo.sk</email>
  </committer>
</commit>
