class Notifly::ActionViewHelper

Attributes

action_view[R]

Public Class Methods

new() click to toggle source
# File lib/services/action_view_helper.rb, line 6
def initialize
  notifly_path = File.expand_path(File.dirname(File.dirname(__FILE__))) + '../../app/views/notifly'
  rails_path = File.join(Rails.root, 'app/views/notifly')

  ActionController::Base.prepend_view_path(notifly_path)
  ActionController::Base.prepend_view_path(rails_path)

  @action_view = ActionView::Base.new(ActionController::Base.view_paths)
  @action_view.extend ApplicationHelper

  @action_view.class_eval do
    include Notifly::Engine.routes.url_helpers
    Dir[File.join(Rails.root, 'app/helpers/**/*.rb')].each do |f|
      require f
      include f.split('/').last.split('.').first.camelize.constantize
    end

    def protect_against_forgery?
      false
    end

    def main_app
      Rails.application.routes.url_helpers
    end
  end
end

Public Instance Methods

main_app() click to toggle source
# File lib/services/action_view_helper.rb, line 27
def main_app
  Rails.application.routes.url_helpers
end
protect_against_forgery?() click to toggle source
# File lib/services/action_view_helper.rb, line 23
def protect_against_forgery?
  false
end