Created
August 14, 2009 08:39
-
-
Save shingara/167723 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Comment | |
include MongoMapper::Document | |
def self.from_configuration(configuration_id) | |
@@variable_keys ||= [] | |
conf = Configuration.find(configuration_id) | |
connect_to_database(conf) | |
@@variable_keys.each do |k| | |
self.keys.delete(k.to_sym) | |
end | |
@@variable_keys = [] | |
conf.fields.each do |f| | |
unless f.blank? | |
self.key f.to_sym, String | |
Merb.logger.debug "add key #{f}" | |
@@variable_keys << f | |
end | |
end | |
Merb.logger.debug "Comment with fields : #{Comment.keys.keys.inspect}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment