OSDN Git Service

fix: bin tool
[pettanr/pettanr.git] / app / controllers / resource_pictures_controller.rb
index a392b4c..118e49c 100644 (file)
@@ -5,7 +5,7 @@ class ResourcePicturesController < ApplicationController
   else
     before_action :authenticate_resource_reader, :only => [
       :index, :show, :credit, 
-      :by_original_picture, :by_license_group, :by_license, :by_artist
+      :by_original_picture, :by_license_group, :by_license, :by_artist, :search
     ]
     before_action :authenticate_user, :only => [:new, :create, :update, :destroy]
     before_action :authenticate_artist, :only => [:new, :create, :update, :destroy]
@@ -106,4 +106,13 @@ class ResourcePicturesController < ApplicationController
     end
   end
   
+  def search
+    @resource_pictures = ResourcePicture.find_by_md5(params[:md5])
+    
+    respond_to do |format|
+      format.html
+      format.json { render json: @resource_pictures.to_json }
+    end
+  end
+  
 end