OSDN Git Service

t#31223:add them contents list for author and artist
[pettanr/pettanr.git] / app / models / author.rb
index 3fd96ec..3b56286 100644 (file)
@@ -7,6 +7,15 @@ class Author < ActiveRecord::Base
   validates :name, :presence => true, :length => {:maximum => 30}
   validates :user_id, :numericality => true, :existence => {:both => false}
   
+  before_validation :valid_encode
+  
+  def valid_encode
+    ['name'].each do |a|
+      next if attributes[a] == nil
+      raise Pettanr::BadRequest unless attributes[a].valid_encoding?
+    end
+  end
+  
   def supply_default
     self.name = 'no name' if self.name.blank?
   end
@@ -207,7 +216,7 @@ class Author < ActiveRecord::Base
   end
   
   def self.default_resource_picture_page_size
-    25
+    125
   end
   
   def self.resource_picture_max_page_size