<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/album_arts/search.html.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -96,4 +96,14 @@ class AlbumArtsController &lt; ApplicationController
       format.xml  { head :ok }
     end
   end
+  
+  def search
+    q = params[:q]
+    @album_arts = AlbumArt.find(:all, :conditions =&gt; &quot;album_name LIKE '%#{q}%' OR artist_name LIKE '%#{q}%'&quot;)
+    
+    respond_to do |format|
+      format.html
+    end
+  end
+
 end</diff>
      <filename>app/controllers/album_arts_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,8 +6,10 @@
 
 	&lt;%= render :partial =&gt; 'album_art_info', :locals =&gt; { :album_art =&gt; album_art } %&gt;
 
+	&lt;% if album_art.user == current_user %&gt;
     &lt;p&gt;&lt;%= link_to 'Editar', edit_album_art_path(album_art) %&gt;, 
-    &lt;%= link_to 'Apagar', album_art, :confirm =&gt; 'Are you sure?', :method =&gt; :delete %&gt;&lt;/p&gt;
+    &lt;%= link_to 'Apagar', album_art, :confirm =&gt; 'Are you sure?', :method =&gt; :delete  %&gt;&lt;/p&gt;
+	&lt;% end %&gt;
 &lt;/li&gt;
   &lt;% end %&gt;
 &lt;% end %&gt;</diff>
      <filename>app/views/album_arts/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -33,9 +33,11 @@
 	&lt;% if flash[:notice] %&gt;&lt;p class=&quot;flash notice&quot;&gt;&lt;%= flash[:notice] %&gt;&lt;/p&gt;&lt;% end %&gt;
 	&lt;% if flash[:error] %&gt;&lt;p class=&quot;flash error&quot;&gt;&lt;%= flash[:error] %&gt;&lt;/p&gt;&lt;% end %&gt;
 	
-	&lt;% form_tag 'album_arts/search', {:id =&gt; &quot;album_art_search&quot;} do -%&gt;
-		&lt;%= text_field_tag :q %&gt;
-		&lt;%= submit_tag 'Buscar' %&gt;
+	&lt;% form_tag '/album_arts/search', {:id =&gt; &quot;album_art_search&quot;, :method =&gt; &quot;GET&quot;} do -%&gt;
+		&lt;fieldset&gt;
+			&lt;%= text_field_tag :q %&gt;
+			&lt;%= submit_tag 'Buscar' %&gt;
+		&lt;/fieldset&gt;
 	&lt;% end -%&gt;
 
 	&lt;div id=&quot;content&quot;&gt;</diff>
      <filename>app/views/layouts/application.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 ActionController::Routing::Routes.draw do |map|
-  map.resources :album_arts
 
+  map.resources :album_arts, :collection =&gt; { :search =&gt; :get }
 
   map.resources :users, :has_many =&gt; :album_arts
   map.resource  :sessions
@@ -13,4 +13,5 @@ ActionController::Routing::Routes.draw do |map|
 
   map.connect ':controller/:action/:id'
   map.connect ':controller/:action/:id.:format'
-end
+
+end
\ No newline at end of file</diff>
      <filename>config/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,6 +37,12 @@ h2{
     clear:right;
 }
 
+form#album_art_search fieldset {
+	width:1000px;
+	margin:10px auto;
+	text-align:right;
+}
+
 #content {
     width:1000px;
     margin:auto;</diff>
      <filename>public/stylesheets/cdcovers.css</filename>
    </modified>
    <modified>
      <diff>@@ -193,7 +193,7 @@ describe AlbumArtsController do
       response.should be_redirect
     end
 
-    it &quot;should be successful&quot; do
+    it &quot;should be successful when logged in&quot; do
       do_login
       do_get
       response.should be_success
@@ -336,4 +336,32 @@ describe AlbumArtsController do
       response.should redirect_to(album_arts_url)
     end
   end
+  
+  describe &quot;searching album art&quot; do
+
+    before(:each) do
+      @album_art = mock_model(AlbumArt)
+      AlbumArt.stub!(:find).and_return(@album_art)
+    end
+
+    def do_get
+      get :search, :q =&gt; &quot;pitty&quot;
+    end
+    
+    it &quot;should search for the album art with the parameter passed&quot; do
+      AlbumArt.should_receive(:find).and_return(@album_art)
+      do_get
+    end
+    
+    it &quot;should render the results page&quot; do
+      do_get
+      response.should render_template('search')
+    end
+    
+    it &quot;should assign the found album_arts for the view&quot; do
+      do_get
+      assigns[:album_arts].should == @album_art
+    end
+
+  end
 end
\ No newline at end of file</diff>
      <filename>spec/controllers/album_arts_controller_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fe1154bdba5d4adf80bf61ac02e5a6760fb78568</id>
    </parent>
  </parents>
  <author>
    <name>Ricardo Shiota Yasuda</name>
    <email>shadow11@gmail.com</email>
  </author>
  <url>http://github.com/shadow11/cd-covers/commit/24ff67b3ee89929ae31eaf2f65e8af3d19cca211</url>
  <id>24ff67b3ee89929ae31eaf2f65e8af3d19cca211</id>
  <committed-date>2008-06-11T15:18:27-07:00</committed-date>
  <authored-date>2008-06-11T15:18:27-07:00</authored-date>
  <message>Added search</message>
  <tree>89a55f96d6e74995f49e32a2591510565b567f5c</tree>
  <committer>
    <name>Ricardo Shiota Yasuda</name>
    <email>shadow11@gmail.com</email>
  </committer>
</commit>
