OSDN Git Service

update speech and balloon
[pettanr/pettanr.git] / app / models / balloon.rb
index 391b933..eebf969 100644 (file)
@@ -1,9 +1,16 @@
 class Balloon < ActiveRecord::Base
-  has_many :speeches
-  belongs_to :panel
+  belongs_to :speech_balloon
   belongs_to :system_picture
-  accepts_nested_attributes_for :speeches
   
+  validates :speech_balloon_id, :presence => true, :numericality => true, :existence => true
+  validates :system_picture_id, :presence => true, :numericality => true, :existence => true
+  validates :x, :presence => true, :numericality => true
+  validates :y, :presence => true, :numericality => true
+  validates :width, :presence => true, :numericality => true, :natural_number => true
+  validates :height, :presence => true, :numericality => true, :natural_number => true
+#  validates :caption, :presence => true
+#  validates :settings, :presence => true
+
   def url
     '/system_pictures/' + self.system_picture.filename
   end