Sha256: 3b3d7e9aef0a1958d0f47b695a0ac2341967fa23381d5dcf78b97f2b8fad318d
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
class PostDecorator < Draper::Decorator # don't delegate_all here because it helps to identify things we # have to delegate for ActiveModel compatibility # need to delegate attribute methods for AM::Serialization # need to delegate id and new_record? for AR::Base#== (Rails 3.0 only) delegate :id, :created_at, :new_record? def posted_date if created_at.to_date == DateTime.now.utc.to_date "Today" else "Not Today" end end def path_with_model h.post_path(source) end def path_with_id h.post_path(id: id) end def url_with_model h.post_url(source) end def url_with_id h.post_url(id: id) end def link h.link_to id.to_s, self end def truncated h.truncate("Once upon a time in a world far far away", length: 17, separator: ' ') end def html_escaped h.html_escape("<script>danger</script>") end def hello_world h.hello_world end def goodnight_moon h.goodnight_moon end def updated_at :overridden end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
draper-1.2.0 | spec/dummy/app/decorators/post_decorator.rb |
jamesgolick-draper-1.1.1a | spec/dummy/app/decorators/post_decorator.rb |
draper-1.1.0 | spec/dummy/app/decorators/post_decorator.rb |