Skip to content

Instantly share code, notes, and snippets.

@mark-ellul
Created March 25, 2011 18:49
Show Gist options
  • Save mark-ellul/887371 to your computer and use it in GitHub Desktop.
Save mark-ellul/887371 to your computer and use it in GitHub Desktop.
Simple model
module RcmEngine
class Organization < CouchRest::Model::Base
include CouchRest::Paperclip
property :description, String
property :name, String
property :remix_organization, Integer
property :subdomains, [String] #These will be used to hook up to the
view_by :subdomain, :map => "
function(doc) {
if ((doc['couchrest-type'] == 'RcmEngine::Organization') && (doc['subdomains']!=null)) {
for(var idx in doc.subdomains) {
emit(doc.subdomains[idx], doc);
}
}
}"
def self.get_for_subdomain(subdomain)
organization = Organization.find_by_subdomain(subdomain)
organization
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment