OSDN Git Service

fix: any
[pettanr/pettanr.git] / app / models / panel_picture.rb
index 3713764..2406f77 100644 (file)
@@ -5,7 +5,8 @@ class PanelPicture < Peta::Element
   
   validates :panel_id, :numericality => {:allow_blank => true}
   validates :picture_id, :numericality => true, :existence => {:both => false}
-  validates :link, :length => {:maximum => 200}, :url => {:allow_blank => true, :message => I18n.t('errors.messages.url')}
+  validates :link, :length => {:maximum => 200}, :allow_blank => true
+  #validates :link, :length => {:maximum => 200}, :url => {:allow_blank => true, :message => I18n.t('errors.messages.url')}
   validates :x, :presence => true, :numericality => true
   validates :y, :presence => true, :numericality => true
   validates :width, :presence => true, :numericality => true, :not_zero => true, :reverse => true, :sync_vh => true
@@ -125,6 +126,14 @@ class PanelPicture < Peta::Element
     {:include => {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}}}}
   end
   
+  def disp_link
+    if self.link =~ /\:\/\//
+      self.link
+    else
+      '/' + self.link.to_s
+    end
+  end
+  
   def scenario
     if caption.blank?
       ''