rails/rails-observers

sweepers never trigger model callbacks

apolishch opened this issue · 1 comments

This is on rails 3.2.16

I have the following controller:

   `class VehicleController < ApplicationController
        cache_sweeper :vehicle_sweeper

        def update
            @vehicle.assign_attributes(params[:vehicle])
            @vehicle.save
         end
    end`


The following sweeper:

     `class VehicleSweeper < ActionController::Caching::Sweeper
           observe Vehicle

           def intialize
                puts "foo I'm in the sweeper"
           end

            def before_save(vehicle)
                 puts "why am I not getting called?"
            end
       end`

The sweeper loads (the initialize is triggered), but the before_save never is.

What could be causing this?

We have tests to ensure this is working. Also Rails 3.2 is not supported anymore. I can reopen this issues if you could create a Rails 4 application reproducing it. Thanks