Created
March 25, 2011 18:49
-
-
Save mark-ellul/887371 to your computer and use it in GitHub Desktop.
Simple model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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