class Panel < ActiveRecord::Base
belongs_to :author
belongs_to :resource_picture
- has_many :stories
+ has_many :scroll_panels
has_many :panel_pictures, :dependent => :destroy
has_many :speech_balloons, :dependent => :destroy
has_many :ground_pictures, :dependent => :destroy
validates :width, :presence => true, :numericality => true, :natural_number => true
validates :height, :presence => true, :numericality => true, :natural_number => true
validates :border, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
- validates :x, :numericality => {:allow_blank => true}
- validates :y, :numericality => {:allow_blank => true}
- validates :z, :numericality => {:allow_blank => true, :greater_than => 0}
validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
validates :publish, :presence => true, :numericality => true
return false unless reader_role_check(roles)
end
return true if self.own?(roles)
+ return true if self.new_record?
self.publish?
end
self.publish > 0
end
- def tag_id
- 'panel' + self.tag_panel_id
+ def tag_id c = nil
+ 'panel' + self.tag_panel_id + c.to_s
end
def tag_panel_id
}.merge(opt)
end
- def select_tag_attributes(selected, column)
+ def select_tag_attributes(selected, column, opt = {})
[
:last, :first,
{:html => {:selected => selected}},
- self.field_tag_attributes(column)
+ self.field_tag_attributes(column, opt)
]
end