Skip to content

Instantly share code, notes, and snippets.

@shingara
Created August 14, 2009 08:39
Show Gist options
  • Save shingara/167723 to your computer and use it in GitHub Desktop.
Save shingara/167723 to your computer and use it in GitHub Desktop.
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