Skip to content

Instantly share code, notes, and snippets.

@mcfiredrill
Created May 15, 2012 22:22
Show Gist options
  • Save mcfiredrill/2705583 to your computer and use it in GitHub Desktop.
Save mcfiredrill/2705583 to your computer and use it in GitHub Desktop.
class_eval in active record callback
after_save do |my_model|
self.class_eval do
# my_model.job_owner_type => "AnotherModel"
alias_method my_model.job_owner_type.underscore.to_sym, :job_owner
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment