Skip to content

Instantly share code, notes, and snippets.

@achiurizo
Created June 6, 2010 23:13
Show Gist options
  • Save achiurizo/428017 to your computer and use it in GitHub Desktop.
Save achiurizo/428017 to your computer and use it in GitHub Desktop.
class Photo
include Mongoid::Document
include Mongoid::Timestamps # adds created_at and updated_at fields
# fields
field :caption, :type => String
field :tags, :type => Array, :default => []
before_save :make_tags
# fix tag
def make_tags
self.tags = self.tags.split(",") if self.tags.is_a?(String)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment