title: Rails: Run callback only for CRUD operation?
body: <p>I'm in Rails 3. Here's my code for a method which creates Update records in response to certain attributes being changed on a model called Candidate:</p>
  
  <pre><code>before_save :check_changed, on: [:update]
  def check_changed
    tracked_attributes = ["period_contributions", "total_contributions",
                          "period_expenditures", "total_expenditures",
                          "debts_and_loans", "cash_on_hand",
                          "major_endorsements",
                          "rating_afl_cio",
                          "rating_cal_tax",
                          "rating_cc",
                          "rating_eqca",
                          "rating_lcv",
                          "rating_now"]
    changes.each do |key, value|
      if tracked_attributes.include?(key)
        Update.create(:candidate_id =&gt; self.id, :attribute_name =&gt; key, 
      :new_value =&gt; value[1], :old_value =&gt; value[0])
      end
    end
  end
  </code></pre>
  
  <p>The issue is that I have some rake tasks I'm running to do batch updates to the data, which end up triggering this callback unintentionally. I'd like for it only to run when a Candidate is updated from within the admin tool aka CRUD interface. Any advice on the best way to do this?</p>