Module: GoogleAnalyticsOnRails::ControllerMixin::ClassMethods

Defined in:
lib/google_analytics_on_rails/controller_mixin.rb

Instance Method Summary collapse

Instance Method Details

#google_analytics(*args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/google_analytics_on_rails/controller_mixin.rb', line 27

def google_analytics(*args)
  class_eval <<-RUBY
    include       GoogleAnalyticsOnRails::ControllerMixin::InstanceMethods
    helper        GoogleAnalyticsOnRails::ControllerMixin::HelperMethods

    attr_accessor :google_analytics
    helper_method :google_analytics
  RUBY

  prepend_before_filter do |controller|
    controller.send(:google_analytics=, GoogleAnalytics.new(*args))
  end
end