OSDN Git Service

eaff13042bc5001658e9c7c08cdcbe3a1cfccafd
[pettanr/pettanr.git] / app / models / panel_picture.rb
1 class PanelPicture < ActiveRecord::Base
2   belongs_to :panel
3   belongs_to :resource_picture
4   
5   def flip
6     res = (self.height < 0 ? '' : 'v') + (self.width == 0 ? '' : 'h')
7     res += '/' unless res.empty?
8     res
9   end
10   
11   def filename
12     flip + self.resource_picture.filename
13   end
14   
15   def url
16     '/resource_pictures/' + filename
17   end
18   
19 end