OSDN Git Service

Suppress paperclip-related keys
authoreagletmt <eagletmt@gmail.com>
Tue, 13 Nov 2012 12:56:58 +0000 (21:56 +0900)
committereagletmt <eagletmt@gmail.com>
Tue, 13 Nov 2012 12:56:58 +0000 (21:56 +0900)
CutenServer/app/models/apk.rb

index 96f45e6..b038eb7 100644 (file)
@@ -15,7 +15,14 @@ class Apk < ActiveRecord::Base
 
   include JsonWithoutTimestamps
   def as_json(options = {})
-    super options.merge({:except => [:task_id]})
+    ignore_keys = [
+      :task_id,
+      :apk_content_type,
+      :apk_file_name,
+      :apk_file_size,
+      :apk_updated_at,
+    ]
+    super options.merge({:except => (options[:except] || []) + ignore_keys})
   end
 
   after_initialize do |apk|