Skip to content

Instantly share code, notes, and snippets.

@toretore
Created February 27, 2012 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toretore/1922637 to your computer and use it in GitHub Desktop.
Save toretore/1922637 to your computer and use it in GitHub Desktop.
something like this in the contract model
class Contract < ActiveRecord::Base
has_paper_trail
acts_as_restful_list
CHANGE_FIELDS_MAP = {
'contract_status_id' => {
:association => 'contract_status'
:field => 'name'
}
}
belongs_to :sales_rep
belongs_to :contract_status
def get_change_value(field)
if map = CHANGE_FIELDS_MAP[field]
send(map[:association]).send(map[:field])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment