Created
March 25, 2011 19:51
-
-
Save timanglade/887514 to your computer and use it in GitHub Desktop.
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
require 'couchrest_model' | |
module RcmEngine | |
class Organization < CouchRest::Model::Base | |
use_database CouchRest.database('http://<LOGIN>:<PASSWORD>@<ACCOUNT>.cloudant.com/rcm_engine_remix_rcm/') | |
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