Skip to content

Instantly share code, notes, and snippets.

class Cell < ActiveRecord::Base
composed_of :extent, :class_name => "Vector", :mapping => %w(extent_x extent_y extent_z), :constructor => Proc.new { |x,y,z| Vector.elements([x, y, z]) }
def as_json(options={})
{:name => self.name, :id => self.id, :extent => [self.extent_x, self.extent_y, self.extent_z]}
end
end