I have a script in which I would like to pass a long message with my JSON. Instead of writing it with a concatenation string, I would prefer to put together an erb template that I can display in my JSON. Below is the code I'm trying now:
object @invitation
node(:phone_message) do |invitation|
begin
old_formats = formats
self.formats = [:text]
view_renderer.render( self, {:template => "invitation_mailer/rsvp_sms", :object => @invitation})
ensure
self.formats = old_formats
end
end
Everything works as expected when I run this code for the first time, however I run into problems the second time I run it because it says that there is a missing instance variable (which I suppose was generated and cached the first time launch).
undefined method _app_views_invitation_mailer_rsvp_sms_text_erb___2510743827238765954_2192068340 for # (ActionView :: Template :: Error)
Is there a better way to render erb patterns in rabl?