Class: Ecm::Pictures::Picture

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

Instance Method Summary collapse

Instance Method Details

#display_code(style) ⇒ Object



50
51
52
53
54
55
56
57
# File 'app/models/ecm/pictures/picture.rb', line 50

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

#display_code_for_erb ⇒ Object



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

def display_code_for_erb
  display_code(:erb)
end

#display_code_for_textile ⇒ Object



46
47
48
# File 'app/models/ecm/pictures/picture.rb', line 46

def display_code_for_textile
  display_code(:textile)
end

#human ⇒ Object



63
64
65
# File 'app/models/ecm/pictures/picture.rb', line 63

def human
  name
end

#to_s ⇒ Object



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

def to_s
  name
end