X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fmodels%2Fspeech_balloon.rb;h=10333606b173716af4d7a7171f80e1e8fd625196;hb=9e6a7b976f22e15609976da5194ea6344e71ea4d;hp=00b5901da6c8556865eff8df8fb7c5d695137df0;hpb=02ea4fc4bbe7a54dd576c1cd700aa9e32710abf8;p=pettanr%2Fpettanr.git diff --git a/app/models/speech_balloon.rb b/app/models/speech_balloon.rb index 00b5901d..10333606 100644 --- a/app/models/speech_balloon.rb +++ b/app/models/speech_balloon.rb @@ -1,4 +1,4 @@ -class SpeechBalloon < ActiveRecord::Base +class SpeechBalloon < Pettanr::Item include Element include ElementInspire has_one :balloon, :dependent => :destroy @@ -16,13 +16,20 @@ class SpeechBalloon < ActiveRecord::Base validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0} validates :settings, :extend_speech_balloon => true - before_validation :valid_encode + def self.singular + 'SpeechBalloon' + end - def valid_encode - ['caption', 'classname', 'settings'].each do |a| - next if attributes[a] == nil - raise Pettanr::BadRequest unless attributes[a].valid_encoding? - end + def self.plural + 'SpeechBalloons' + end + + def self.owner_type + :author + end + + def self.valid_encode_columns + super.merge ['caption', 'classname', 'settings'] end def self.list_opt_for_panel