module Douglas::Rails::Controller
Extensions to rails controllers. Provides convenient ways to pass certain information to the model layer via `the_stamper`.
Protected Instance Methods
user_for_douglas()
click to toggle source
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.
# File lib/douglas/frameworks/rails/controller.rb, line 13 def user_for_douglas return unless defined?(current_user) ActiveSupport::VERSION::MAJOR >= 4 ? current_user.try!(:id) : current_user.try(:id) rescue NoMethodError current_user end
Private Instance Methods
set_douglas_the_stamper()
click to toggle source
Tells Douglas
who is responsible for any changes that occur
# File lib/douglas/frameworks/rails/controller.rb, line 23 def set_douglas_the_stamper ::Douglas.the_stamper = user_for_douglas end