<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,16 +1,11 @@
 class Admin::PreferencesController &lt; AdminController
-  def index
-    @preferences = Preference.all
-  end
-  
   def edit
-    @preference = Preference.find_by_name(params[:id])
+    @preferences = Preference.all
   end
   
   def update
-    @preference = Preference.find_by_name(params[:id])
-    @preference.update_attribute('value', params[:value])
-    flash[:success] = &quot;You have succesfully updated the preference&quot;
-    redirect_to edit_admin_preference_path(params[:id])
+    @preferences = Preference.update_many(params[:preferences])
+    flash[:success] = &quot;Preferences have been updated&quot;
+    redirect_to edit_admin_preferences_path
   end
 end</diff>
      <filename>app/controllers/admin/preferences_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -35,8 +35,8 @@ class Preference &lt; ActiveRecord::Base
     &quot;)
   end
   
-  def self.update_multiple(preference_hash)
-    preference_hash.each do |key, value|
+  def self.update_many(preference_hash)
+    preference_hash.collect do |key, value|
       logger.info &quot;Setting preference: #{key.to_s}, #{value}&quot;
       Preference.set(key.to_s, value)
     end</diff>
      <filename>app/models/preference.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,7 @@
       - if logged_in?
         %ul#navigation
           %li= link_to &quot;Posts&quot;, admin_posts_path
-          %li= link_to &quot;Preferences&quot;, admin_preferences_path          
+          %li= link_to &quot;Preferences&quot;, edit_admin_preferences_path
           %li= link_to &quot;Logout&quot;, logout_url
         %ul#subnavigation= yield :subnavigation
     #page</diff>
      <filename>app/views/layouts/admin.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ ActionController::Routing::Routes.draw do |map|
   # Resources
   map.namespace   :admin do |admin|
     admin.resources :posts
-    admin.resources :preferences
+    admin.resource  :preferences
   end
   
   map.resources   :posts  </diff>
      <filename>config/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ describe Admin::PreferencesController do
 
   # TODO: Make this part of a global admin_spec and use It Should Behave Like
   it &quot;requires logging admin privallages&quot; do
-    get :index
+    get :edit
     response.should redirect_to(login_path)
   end
 
@@ -16,24 +16,18 @@ describe Admin::PreferencesController do
     
     describe &quot;list action&quot; do
       it &quot;should get a collection of preferences&quot; do
-        get :index
+        get :edit
         assigns(:preferences).should_not be_empty
       end
     end
   
     describe &quot;edit action&quot; do
-      it &quot;should get a preference&quot; do
-        get :edit, :id =&gt; &quot;name&quot;
-        assigns(:preference).should_not be_nil
-        response.should be_success
-      end
-      
-      it &quot;should update the preference&quot; do
-        put :update, :id =&gt; &quot;name&quot;, :value =&gt; &quot;simple&quot;
-        assigns(:preference).should_not be_nil
+      it &quot;should succesfully complete the action&quot; do
+        Preference.should_receive(:update_many).once.and_return(true)
+        put :update, :preferences =&gt; { :name =&gt; &quot;simple&quot;, :theme =&gt; &quot;fuschia&quot; }
+        assigns(:preferences).should_not be_nil
         response.should be_redirect
       end
     end
   end
-
 end</diff>
      <filename>spec/controllers/admin/preferences_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,15 +24,15 @@ describe Preference do
     end
   end
   
-  describe &quot;.update_multiple&quot; do
-    it &quot;should update multiple rows of preferences&quot; do
+  describe &quot;.update_many&quot; do
+    it &quot;should update many rows of preferences&quot; do
       preferences = {
         :name   =&gt; 'testing',
         :theme  =&gt; 'testing',
         :url    =&gt; 'http://local.testing'
       }
       lambda do
-        Preference.update_multiple(preferences)
+        Preference.update_many(preferences)
       end.should change { Preference.get(&quot;theme&quot;, true) }
     end
   end</diff>
      <filename>spec/models/preference_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ba8d66e075339d9db0489ec3e3946c936a9b5223</id>
    </parent>
  </parents>
  <author>
    <name>Zach Inglis</name>
    <email>zach@lt3media.com</email>
  </author>
  <url>http://github.com/zachinglis/mouth/commit/cba812f95c2a262c88e563e1ee229d3af62e3491</url>
  <id>cba812f95c2a262c88e563e1ee229d3af62e3491</id>
  <committed-date>2008-08-09T10:36:02-07:00</committed-date>
  <authored-date>2008-08-09T10:36:02-07:00</authored-date>
  <message>Preferences controller actions completed</message>
  <tree>2ee2d720f34a25f619c89987d88a49827644324f</tree>
  <committer>
    <name>Zach Inglis</name>
    <email>zach@lt3media.com</email>
  </committer>
</commit>
