Module: EffectiveMembershipsCard
- Extended by:
- ActiveSupport::Concern
- Included in:
- Effective::MembershipCard
- Defined in:
- app/models/concerns/effective_memberships_card.rb
Overview
EffectiveMembershipsCard Mark your card model with include EffectiveMembershipsCard to get all the includes
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #content_type ⇒ Object
- #filename ⇒ Object
-
#owner ⇒ Object
Instance Methods.
- #pdf ⇒ Object
- #to_pdf ⇒ Object
Instance Method Details
#content_type ⇒ Object
25 26 27 |
# File 'app/models/concerns/effective_memberships_card.rb', line 25 def content_type 'application/pdf' end |
#filename ⇒ Object
29 30 31 |
# File 'app/models/concerns/effective_memberships_card.rb', line 29 def filename "#{self.class.name.split('::').first.downcase}-membership-card-#{Time.zone.now.strftime('%F')}.pdf" end |
#owner ⇒ Object
Instance Methods
21 22 23 |
# File 'app/models/concerns/effective_memberships_card.rb', line 21 def owner membership&.owner end |
#pdf ⇒ Object
42 43 44 |
# File 'app/models/concerns/effective_memberships_card.rb', line 42 def pdf @pdf ||= build_pdf() end |
#to_pdf ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/models/concerns/effective_memberships_card.rb', line 33 def to_pdf raise('is invalid') unless valid? return pdf.render() if pdf.respond_to?(:render) # Prawn return pdf.to_pdf() if pdf.respond_to?(:to_pdf) # CombinePdf pdf end |