Class: SpudBanner

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

Instance Method Summary collapse

Instance Method Details

#dynamic_stylesObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/spud_banner.rb', line 36

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

#expired?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'app/models/spud_banner.rb', line 53

def expired?
  return end_date.present? && end_date < Time.zone.today
end

#set_nameObject



49
50
51
# File 'app/models/spud_banner.rb', line 49

def set_name
  return owner.name
end