Module: Gricer::ActionController::Base

Defined in:
lib/gricer/action_controller/base.rb

Overview

Gricer’s ActionController base enhancements

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Include the helper functions into controllers.



8
9
10
11
12
# File 'lib/gricer/action_controller/base.rb', line 8

def self.included(base)
  base.module_eval do
    helper_attr :gricer_user_id
  end
end

Instance Method Details

#gricer_user_idInteger

This function is a stub for the mechanism to include the current users id into the statistics of gricer.

Examples:

The most common case would be to pass the current_user’s id. So this is the code you should add to your appliction_controller

def gricer_user_id
  current_user.try(:id)
end

Returns:

  • (Integer)


21
22
23
# File 'lib/gricer/action_controller/base.rb', line 21

def gricer_user_id
  nil
end