something like this in the contract model
This file contains 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
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