Question: Accoding to [this](https://stackoverflow.com/questions/1586536/how-to-detect-attribute-changes-from-model) stackoverflow post, I can use the following to detect attribute changes:

```
self.changes

```

And it *does* work when I use it in the model, such in an after\_update callback:

```
  def check_activity
    changes = self.changes
    puts changes
  end

```

Unfortunately, it is not working in my controller update action. I tried to use it before the task was saved and after the task was saved:

```
  def update
    changes = @task.changes

    if @task.update_attributes(task_params)
      changes2 = @task.changes

      flash[:notice] = "Successfully updated task."
      redirect_to polymorphic_path([@taskable, @task])
    else
      render :edit
    end
  end

```

Unfortunately in both cases, it is empty:

```
Empty ActiveSupport::HashWithIndifferentAccess

```

What might I be doing wrong?

Answer: 
There aren't any changes to show after you've made the change (IE update\_attributes runs)

You could try using assign\_attributes instead of update\_attributes, checking that everything is valid (object.valid?) getting your changes and then saving
Just check out `ActiveModel::Dirty` 

Changes method does not returns changes after save.you should use it in before save, if you want to check the value after save use these ones `previous_changes` etc. for detail checkout `http://api.rubyonrails.org/classes/ActiveModel/Dirty.html.`