Hovercard arguments serialization

Arguments passed to an hovercard with the .with class method are serialized prior to be inserted in DOM so they can be sent later when rendering hovercard. This serialization step pretty much works like ActionMailer or ActiveJob params and is basically turning arguments into JSON. It means that objects implementing the GlobalID interface, typically any ActiveRecord::Base instance, will not be stringified but turn into global id so you won’t have to deserialize it when getting it from params.

Examples:

class Project < ApplicationRecord
end
<% @project.class # => Project %>
<%= coupdoeil_hovercard_tag ProjectHovercard.with(project: @project).summary do %>
  <p><%= @project.name %></p>
<% end %>

All params passed to .with are accessible through #params within action method as a HashWithIndifferentAccess.

class ProjectHovercard < ApplicationHovercard
  def summary
    @project = params[:project]
    @project.class # => Project
  end
end