Skip to content
Brad Fults edited this page Oct 18, 2011 · 2 revisions

Boxes can take multiple arguments, the last of which, when it's a Hash, can also pass options to Boxer itself:

Boxer.box(:user) do |box, user, viewer, opts|
  box.view(:base) do
    {
      :name       => user.name,
      :is_friend  => user.friend?(viewer),
      :car_make   => opts[:car_make] || user.car_make,
    }
  end
end

Currently the only option to pass to Boxer is :view:

Boxer.ship(:user, User.first, current_user, :view => :base)
Clone this wiki locally