title: After_save with parameter
body: <p>This is my model code:</p>
  
  <pre><code>after_create :notify_cards_create
  after_destroy :notify_cards_destroy
  after_update :notify_cards_update
  
  def notify_cards_update
     WebsocketRails[:home].trigger 'cards', {type: 'update', card: self.as_json({small: true})}
  end
  
  def notify_cards_create
      WebsocketRails[:home].trigger 'cards', {type: 'create', card: self.as_json({small: true})}
  end
  
  def notify_cards_destroy
      WebsocketRails[:home].trigger 'cards', {type: 'destroy', card: self.as_json({small: true})}
  end
  </code></pre>
  
  <p>As you can see it contains many duplications! How can i shorten this code to something like:</p>
  
  <pre><code>after_create :notify_cards_create,   'create'
  after_destroy :notify_cards_destroy, 'destroy'
  after_update :notify_cards_update,   'update'
  </code></pre>
  
  <p><b>Thank you!</b></p>