Skip to content

Instantly share code, notes, and snippets.

@nzifnab
Created April 30, 2011 00:12
Show Gist options
  • Save nzifnab/949265 to your computer and use it in GitHub Desktop.
Save nzifnab/949265 to your computer and use it in GitHub Desktop.
Get content_ui for log
acts_as_event_logger(
:attributes => [:active, :contact, :company_name, [:primary_address, :address_change], [:primary_address, :phone_change], [:primary_address, :phone2_change],
[:primary_address, :fax_change], :url, :description, :services, :coverage, :memberships, :business_since, :license_number, [:owners, :email], content_x_log_array ],
:cache_values => [:owners],
:event_type => "Profile Update"
)
#return an array of arrays for the act event logger track changes in content_ui fields
# [ profile content real name, "displayed field name: displayed field value"]
def content_x_log_array
content_ui_log_instructions = (1..20).map {|n| ["content_#{n}", lambda{|value| "#{get_display_name(n)} : #{value}" }}
end
def get_display_name(n)
if template_group.present? && ci = template_group.content_uis.find_by_generic_field_number(n)
ci.field_name.titleize.gsub(/\s+/, '').underscore.to_sym
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment