class Balloon < ActiveRecord::Base
- has_many :speaches
- belongs_to :panel
- belongs_to :resource_picture
- accepts_nested_attributes_for :speaches
+ belongs_to :speech_balloon
+ belongs_to :system_picture
- def picture_url
- '/resource_pictures/' + self.resource_picture.filename
+ validates :speech_balloon_id, :numericality => {:allow_blank => 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
end