Skip to content

Instantly share code, notes, and snippets.

@mwawrusch
Created February 12, 2011 07:46
Show Gist options
  • Save mwawrusch/823588 to your computer and use it in GitHub Desktop.
Save mwawrusch/823588 to your computer and use it in GitHub Desktop.
class StoreFront
# Indexes
# StoreFront.ensure_index(:import_source)
include MongoMapper::Document
plugin MongoMapper::Plugins::Sluggable
STORE_OPERATOR_NAMES = %w[apple]
timestamps!
key :_id, String
key :name, String, :required => true, :length => 1..1000
key :description , String, :default => ""
key :store_operator_name, String, :length => 1..100
key :country_code, String, :length => 3, :required => true
key :import_source, Array
#slug_key :name, :unique => true #, :min_length =>3, :max_length => 100
sluggable :name, :method => :slug_method
def slug_method
"#{store_operator_name}-#{name}".parameterize
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment