haml: ActionView::Template::Error (Unsupported callback code)

I’ve updated HAML to 5.0.1 as part of ongoing work to port our Rails app from 5.0.2 to 5.1.2 (previous HAML version was 4.0.7).

I was seeing a deprecation warning regarding Erubis/Erubi, hence upgrading HAML:

DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead. (called from <top (required)> at /Users/sean/src/datacentred/stronghold/config/application.rb:7)

Now I’m met with this strange error when I try to log into our app:

Started GET "/sign_in?next=%2F" for ::1 at 2017-07-26 15:39:46 +0100
   (0.3ms)  SET NAMES utf8,  @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'),  @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
   (0.3ms)  SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Processing by SessionsController#new as HTML
  Parameters: {"next"=>"/"}
  Rendering sessions/new.html.haml within layouts/customer-sign-up
  Rendered sessions/new.html.haml within layouts/customer-sign-up (10.0ms)
Completed 500 Internal Server Error in 29ms (ActiveRecord: 0.0ms)



ActionView::Template::Error (Unsupported callback code):

Here is the contents of sessions.new.html.haml:

- title "Sign In"

%h3 Sign In

= display_flash

= form_for(User.new, :url => sessions_path, :method => :post, :html => {:role => 'form'}) do |f|
  = hidden_field_tag :next, params[:next]
  .form-group
    = f.email_field :email, :class => "form-control",
                    :id => "inputEmail", :placeholder => "Email address", :autofocus => ''
  .form-group
    = f.password_field :password, :class => "form-control wink-password",
                       :id => "inputPassword", :placeholder => "Password"
  = f.submit 'Sign In', :class => 'btn btn-primary', style: 'width: 100%; margin-bottom: 10px'
  .pull-right
    = link_to 'Reset Password', new_reset_path
    |
    = link_to 'Create Account', create_signup_path
  %p= link_to 'Trouble logging in?', ExternalLinks.cookie_documentation_path

If I change the contents of the template new.html.haml to the text “Hello” then I get this error:

ActionView::Template::Error (Unsupported callback static)

I’ve spent a few hours trying to find anything helpful online regarding this, but so far I’ve seen nothing.

Any clues what may be going on here?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

The issue was that the clock.rb files content was not ‘namespaced’:

include Clockwork
every(1.hour, ...
...

After moving it under the module the problem was solved:

module Clockwork
  every(1.hour, ...
end

I closed the issues on temple and clockwork 👍

I appreciate that @k0kubun but I’m working on a commercial project and I can’t share the code.

I’ve tried to reproduce the issue in a new repository and I had no luck - I just can’t get it to reproduce. I will continue attempting to debug it in our codebase and post an update here if I discover the root cause. Or perhaps others will find this issue if they see similar problems elsewhere.

In the meantime, I guess there’s nothing to do but close this issue for now.