Skip to content

Commit

Permalink
don't be so furious with the logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mccolin committed Apr 18, 2010
1 parent d8fe7c3 commit 4a15ff2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/do_document_fields.rb
Expand Up @@ -30,7 +30,7 @@ def do_document_fields(*args)
extend ClassMethods
include InstanceMethods
column_name = args.shift || :document
logger.debug "DOCUMENT_FIELDS: do_document_fields turned on for #{self.name} in column #{column_name}"
##logger.debug "DOCUMENT_FIELDS: do_document_fields turned on for #{self.name} in column #{column_name}"
serialize "#{column_name}".to_sym, Hash

cattr_accessor :document_column_names
Expand Down Expand Up @@ -71,17 +71,17 @@ def declare_document_field(*args)
column_name = args.shift; raise NoColumnNameSpecified unless column_name
field_name = args.shift; raise NoFieldNameSpecified unless field_name
field_opts = args.shift || Hash.new
logger.debug "DOCUMENT_FIELDS: declare_document_field invoked for \"#{column_name}\" column with \"#{field_name}\" field"
##logger.debug "DOCUMENT_FIELDS: declare_document_field invoked for \"#{column_name}\" column with \"#{field_name}\" field"
self.send("document_fields").send("<<", field_name)
self.send("#{column_name}_fields").send("<<", field_name)

define_method(field_name) do
logger.debug "DOCUMENT_FIELDS: accessor invoked for field:#{field_name} on column:#{column_name}"
#logger.debug "DOCUMENT_FIELDS: accessor invoked for field:#{field_name} on column:#{column_name}"
document_body = self.send(column_name) || Hash.new
document_body[field_name]
end
define_method("#{field_name}=") do |val|
logger.debug "DOCUMENT_FIELDS: updater invoked for field:#{field_name} on column:#{column_name}"
#logger.debug "DOCUMENT_FIELDS: updater invoked for field:#{field_name} on column:#{column_name}"
document_body = self.send(column_name) || Hash.new
document_body[field_name] = val
self.send("#{column_name}=", document_body)
Expand All @@ -103,7 +103,7 @@ def declare_document_index(*args)
class_name = self.name.underscore
class_table_name = self.table_name
index_table_name = "document_indexes_for_#{class_table_name}"
logger.debug "DOCUMENT_FIELDS: declare_document_index invoked for \"#{column_name}\" column with \"#{field_name}\" field on #{class_name}"
#logger.debug "DOCUMENT_FIELDS: declare_document_index invoked for \"#{column_name}\" column with \"#{field_name}\" field on #{class_name}"
self.send("document_indexes").send("<<", field_name)
self.send("#{column_name}_indexes").send("<<", field_name)

Expand Down Expand Up @@ -138,7 +138,7 @@ def find_with_#{column_name}(hash={})

# after_save callback to update index
define_method("update_document_index_#{column_name}_#{field_name}_after_save") do
logger.debug "DOCUMENT_FIELDS: update_document_index_after_save invoked for \"#{field_name}\"; not yet updating"
#logger.debug "DOCUMENT_FIELDS: update_document_index_after_save invoked for \"#{field_name}\"; not yet updating"
class_name = self.class.name.underscore
class_table_name = self.class.table_name
index_table_name = "document_indexes_for_#{class_table_name}"
Expand All @@ -149,7 +149,7 @@ def find_with_#{column_name}(hash={})

# after_destroy callback to update index
define_method("update_document_index_#{column_name}_#{field_name}_after_destroy") do
logger.debug "DOCUMENT_FIELDS: update_document_index_after_destroy invoked for \"#{field_name}\""
#logger.debug "DOCUMENT_FIELDS: update_document_index_after_destroy invoked for \"#{field_name}\""
class_name = self.class.name.underscore
class_table_name = self.class.table_name
index_table_name = "document_indexes_for_#{class_table_name}"
Expand Down

0 comments on commit 4a15ff2

Please sign in to comment.