There was an error while loading. Please reload this page.
Boxer views support multiple inheritance via the :extends option, which simply merges each view into the previous, in order:
:extends
Boxer.box(:user) do |box, user| box.view(:base) { {:name => user.name} } box.view(:full, :extends => :base) { {:email => user.email} } box.view(:search, :extends => :base) do {:last_seen_at => user.last_seen_at.utc.iso8601} end box.view(:full_with_time, :extends => [:full, :search]) do {:current_time => Time.now.utc.iso8601} end end
Which would give you:
>> Boxer.ship(:user, User.first, :view => :full_with_time) => {:name => "Bob Jones", :email => "b@a.com", :last_seen_at => "2011-10-18T19:00:52Z", :current_time => "2011-10-18T19:02:34Z"}