--
--
You received this message because you are subscribed to the Google
Groups "ror-es" group.
To post to this group, send email to ror...@googlegroups.com
To unsubscribe from this group, send email to
ror_es+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ror_es?hl=en
Rails no escala.
---
You received this message because you are subscribed to the Google Groups "ror-es" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ror_es+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yo movería el código al job. Yo hice algo similar una vez, tienes que crear un ActionView::Base, extenderlo con los helpers que necesites y definir las variables de instancia necesarias (las que tengas en tu acción) con instance_variable_set, finalmente llamar render en el actionview creado.
view_paths = Rails::Application::Configuration.new(Rails.root).paths["app/views"]
av_helper = ActionView::Base.new view_paths
av_helper.extend ControllerHelper
PdfTemplate.prepare_template_for(self, av_helper)
av_helper.instance_variable_set :@record, self
av_helper.render layout: 'pdf.pdf.erb', template: "ninonino/nino_a_nino.html.pdf.erb", pdf: nombre_planilla, orientation: 'Landscape', page_size: 'A4', margin: { top: 35, bottom: 45, left: 5, right: 5}, header: { html: { template: 'ninonino/nino_a_nino_header.pdf.erb' } }, footer: { html: { template: 'ninonino/nino_a_nino_footer.pdf.erb' } }
require 'classes/nino_nino'
class CreaPlanillaNinoninoJob < ApplicationJob
queue_as :default
def perform(*args)
# Do something later
params = args[0]
nino = NinoNino::NinoNinoController.new
nino.crea_certificados params
end
end