Sha256: 2f3d5011ec1a55500412fc1211f651b3a899eb63f254114dcd2a396e7041707a

Contents?: true

Size: 598 Bytes

Versions: 4

Compression:

Stored size: 598 Bytes

Contents

module Mcfly
  module Controller
    def self.included(base)
      base.before_action :set_mcfly_whodunnit
    end

    # Returns the user who is responsible for any changes that occur.
    # By default this calls `current_user` and returns the result.
    #
    # Override this method in your controller to call a different
    # method, e.g. `current_person`, or anything you like.
    def user_for_mcfly
      current_user rescue nil
    end

    # Tells Mcfly who is responsible for any changes that occur.
    def set_mcfly_whodunnit
      ::Mcfly.whodunnit = user_for_mcfly
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mcfly-0.1.0 lib/mcfly/controller.rb
mcfly-0.0.22 lib/mcfly/controller.rb
mcfly-0.0.21 lib/mcfly/controller.rb
mcfly-0.0.20 lib/mcfly/controller.rb