Class: HyoukiController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/hyouki_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/hyouki_controller.rb', line 4

def show
  klass = params[:class].classify.gsub(/::(\w)/) { |s| s.upcase }.constantize
  args = params[:args].split(',').collect { |a| eval(a) }

  @type = params[:type] || 'html'
  @mail = klass.send(params[:method], *args)
  @parts = PremailerRails::Hook.delivering_email(@mail)
  @body = if @parts.count > 1
    @parts.select { |part| part.content_type =~ /#{@type}/ }.first.body.to_s
  else
    @parts.first.body.to_s
  end
end