Nik Todorov
Nik Todorov

Reputation: 766

Liquid::Template... is not visible in the mailer erb file

I'm receiving this error:

Class#new_employee_survey_email failed with ActionView::Template::Error: uninitialized constant ActionView::CompiledTemplates::Liquid ..

The liquid gem is installed. I can use it in views or in the rails console. I can't get it to work in the email template only.

That template have only several html tags and the call to the Liquid class from their example:

    <!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
  <% @template = Liquid::Template.parse("hi {{name}}")  # Parses and compiles the template  %>
  <%= @template.render( 'name' => 'tobi' ) %>


  </body>
</html>

The email is send by delay job if this makes difference.

I will apreciate any help in making this work.

Upvotes: 1

Views: 376

Answers (1)

Nik Todorov
Nik Todorov

Reputation: 766

I found the solution: The jem was successfully found after restarting my box. Possible reasons - the terminal that had "rake jobs:work" running was not aware of the installation and the addition of the Liquid gem to my gem file.

To not look like complete newby ... :(

  1. I have restarted the rake server and the gem started working on all views/controlers but the mailers
  2. I have restarted the the rake job, but not the console that it is running on ...

I hope this helps others to not waste time ... I'm still feeling newb thought :( ...

Upvotes: 1

Related Questions