Sha256: 136ecb6950a478a2e19f6e4671abcbea58cb589706300aaf4bf8bcbe56359041

Contents?: true

Size: 972 Bytes

Versions: 10

Compression:

Stored size: 972 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

10 entries across 10 versions & 1 rubygems

Version Path
ixtlan-0.4.3 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.4.2 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.4.1 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.4.0 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.4.0.pre5 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.4.0.pre4 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.4.0.pre3 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.4.0.pre2 lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.4.0.pre lib/ixtlan/rails/timestamps_modified_by_filter.rb
ixtlan-0.3.0 lib/ixtlan/rails/timestamps_modified_by_filter.rb