Skip navigation

Category Archives: Rails

# Ruby - Rails - Tracing Call to Know Multiple Trigger-call
class Model

  before_update :show_changed_fields

  def show_changed_fields
    p '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
    p Model.columns.map(&:name).select{|v|self.send("#{v}_changed?".to_sym) }
    p caller.select{|x|/\/app\//=~x}.collect{|x|x.split('/')[-1]}
  end

end