Class: Ecm::Pictures::Picture

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/ecm/pictures/picture.rb

Instance Method Summary collapse

Instance Method Details

#display_code(style) ⇒ Object



46
47
48
49
50
51
52
53
# File 'app/models/ecm/pictures/picture.rb', line 46

def display_code(style)
  case style
  when :erb
    "<%= render_picture '#{name}' %>"
  when :textile
    "!#{image.url}!".gsub(/(\?[0-9]{1,})/, '')
  end
end

#display_code_for_erbObject



38
39
40
# File 'app/models/ecm/pictures/picture.rb', line 38

def display_code_for_erb
  display_code(:erb)
end

#display_code_for_textileObject



42
43
44
# File 'app/models/ecm/pictures/picture.rb', line 42

def display_code_for_textile
  display_code(:textile)
end

#humanObject



59
60
61
# File 'app/models/ecm/pictures/picture.rb', line 59

def human
  name
end

#to_sObject



55
56
57
# File 'app/models/ecm/pictures/picture.rb', line 55

def to_s
  name
end