Skip to content

Instantly share code, notes, and snippets.

@jefftrull
Created July 7, 2011 06:00
Show Gist options
  • Save jefftrull/1068965 to your computer and use it in GitHub Desktop.
Save jefftrull/1068965 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment