Module: Prawnto::ActionControllerMixin

Defined in:
lib/prawnto/action_controller_mixin.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

DEFAULT_PRAWNTO_OPTIONS =
{:inline=>true}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/prawnto/action_controller_mixin.rb', line 5

def self.included(base)
  base.send :attr_reader, :prawnto_options
  base.class_attribute :prawn_hash, :prawnto_hash
  base.prawn_hash = {}
  base.prawnto_hash = {}
  base.extend ClassMethods
end

Instance Method Details

#prawnto(options) ⇒ Object

Sets the prawn options. Use in the controller method.

respond_to {|format|

format.pdf { prawnto(:page_orientation => :landscape) }

}



37
38
39
40
# File 'lib/prawnto/action_controller_mixin.rb', line 37

def prawnto(options)
  @prawnto_options ||= {}
  @prawnto_options.merge! options
end