Class: SpudBanner

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/spud_banner.rb

Instance Method Summary collapse

Instance Method Details

#dynamic_stylesObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/spud_banner.rb', line 24

def dynamic_styles
  styles = {
    :tiny => '150x150'
  }
  owner_style = nil
  if self.owner
    owner_style = "#{self.owner.width}x#{self.owner.height}"
    owner_style += '#' if self.owner.cropped
    styles[:banner] = owner_style
  end
  return styles
end

#is_expired?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/spud_banner.rb', line 41

def is_expired?
  return end_date.present? && end_date < Date.today
end

#set_nameObject



37
38
39
# File 'app/models/spud_banner.rb', line 37

def set_name
  return owner.name
end