Module: ReferenceTracking::ActionController::ActMacro
- Defined in:
- lib/reference_tracking/action_controller.rb
Instance Method Summary collapse
- #purge?(action) ⇒ Boolean
- #purges(*actions) ⇒ Object
- #purges? ⇒ Boolean
- #tracks(*args) ⇒ Object
- #tracks_references? ⇒ Boolean
Instance Method Details
#purge?(action) ⇒ Boolean
43 44 45 |
# File 'lib/reference_tracking/action_controller.rb', line 43 def purge?(action) purges? && [:actions].include?(action.to_sym) end |
#purges(*actions) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/reference_tracking/action_controller.rb', line 28 def purges(*actions) unless purges? include ReferenceTracking::ActionController::Purging class_inheritable_accessor :purging_options self. = { :header => PURGE_TAGS_HEADER, :actions => [] } end self.[:actions] += actions.map(&:to_sym) self.[:actions].uniq end |
#purges? ⇒ Boolean
39 40 41 |
# File 'lib/reference_tracking/action_controller.rb', line 39 def purges? respond_to?(:purging_options) end |
#tracks(*args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/reference_tracking/action_controller.rb', line 6 def tracks(*args) unless tracks_references? include ReferenceTracking::ActionController::Tracking class_inheritable_accessor :reference_tracking_options self. = { :header => TAGS_HEADER } end = args. actions = Array(.delete(:only) || [:index, :show]) - Array(.delete(:except)) args << unless .empty? actions.map(&:to_sym).each do |action| self.[action] ||= [] self.[action] += args end end |
#tracks_references? ⇒ Boolean
24 25 26 |
# File 'lib/reference_tracking/action_controller.rb', line 24 def tracks_references? respond_to?(:reference_tracking_options) && .present? end |