Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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