Sha256: a8d7ac6215fa0b92fd3a1c368d05484a6db62a529349f6a3ca532fb0e2ac1498

Contents?: true

Size: 978 Bytes

Versions: 5

Compression:

Stored size: 978 Bytes

Contents

module Ixtlan
  module Rails
    module TimestampsModifiedBy
      module Base
        def self.included(base)
          base.prepend_around_filter(Filter)
        end
      end
      
      class Filter
        def self.filter(controller)
          name = controller.params[:controller]
          unless name.nil?
            parameters = controller.params[name.singular.to_sym]
            unless parameters.nil?
              parameters.delete(:created_at)
              parameters.delete(:created_on)
              parameters.delete(:created_by)
              # do not delete the updated_at so that optimistic persistence
              # can work !!!!
              #parameters.delete(:updated_at)
              parameters.delete(:updated_on)
              parameters.delete(:updated_by)
            end
          end
          yield if block_given?
        end
      end
    end
  end
end

::ActionController::Base.send(:include, Ixtlan::Rails::TimestampsModifiedBy::Base)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ixtlan-0.2.4 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.2.3 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.2.2 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.2.1 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.2.0 lib/ixtlan/rails/timestamps_modified_by_filter.rb