Sha256: a1120da2d65a549f6448f132d5bd52b839c25b947397ed1350a331f4a8c02ebe

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

module KnowledgeBase
  module ApplicationHelper

    # Knowledge base uses the layout of the client application, which causes Rails' url helpers to get confused
    # and require you to prepend 'main_app' to your own routes. This hack allows developers to keep referring to
    # routes without a prefix by sending undefined routes to 'main_app' before failing.
    def method_missing(method, *args, &block)
      if (method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) && main_app.respond_to?(method)
        main_app.send(method, *args)
      else
        super
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knowledge_base-0.2.0 config/initializers/routing.rb
knowledge_base-0.1.0 config/initializers/routing.rb