Popover arguments serialization

Arguments passed to a popover with the .with class method are serialized prior to be inserted in DOM so they can be sent later when rendering popover. 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_popover_tag ProjectPopover.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 ProjectPopover < ApplicationPopover
  def summary
    @project = params[:project]
    @project.class # => Project
  end
end