Card history tab not working, ActionView::Base must implement compiled_method_container

Support Ticket

+tags
 

With the current decko 0.10.0, using card 1.100.0 and rails 6.1.0, an attempt to view the history tab of a card shows a blank tab.  production.log shows the exception when compiled_method_container is called on an instance of ActionView::Base, as shown on line 252 of gems/actionview-6.1.0/lib/action_view/base.rb :

raise NotImplementedError, <<~msg.squish

  Subclasses of ActionView::Base must implement `compiled_method_container`

  or use the class method `with_empty_template_cache` for constructing

  an ActionView::Base subclass that has an empty cache.

msg

It appears that the instance is created in card-1.100.0/lib/card/format.rb in the template method, which is:

def template

  @template ||= begin

    c = controller

    lookup_context = ActionView::LookupContext.new c.class.view_paths

    t = ActionView::Base.new(

      lookup_context, { _routes: c._routes }, c

    )

    t.extend c.class._helpers

    t

  end

end

The workaround I found was to create a simple descendant class of ActionView::Base, which has compiled_method_container defined.  It was convenient to add that at the top of hte format.rb file:

class ActionViewBasePlus < ActionView::Base

  def compiled_method_container

    return self.class

  end

end

Then, modify the template method in the same file to use the new class instead of ActionView::Base:

def template

  @template ||= begin

    c = controller

    lookup_context = ActionView::LookupContext.new c.class.view_paths

    t = ActionViewBasePlus.new(

      lookup_context, { _routes: c._routes }, c

    )

    t.extend c.class._helpers

    t

  end

end

It appears that the template method has already been removed from this file on the master branch of the the github repo, so likely this has already been found and fixed, but the fix has not yet been released.  Until the next version of decko and card is released, I wanted to include this info for anyone else having the same problem and looking for a workaround. 

 


The Rails 6.1 release broke a few things in Decko. We've got things working in the latest code but have to get the code released. Should be this week.

 

In the meantime, you should be able to use an earlier (6.0.x) rails version in your Gemfile.

Ethan McCutchen.....2020-12-20 03:57:46 UTC