Created
April 30, 2011 00:12
-
-
Save nzifnab/949265 to your computer and use it in GitHub Desktop.
Get content_ui for log
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
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