Sha256: 3a631f4973687d4e681e34e6a387ec286f8a853de1b598057e15682b7d03daf7

Contents?: true

Size: 1.16 KB

Versions: 99

Compression:

Stored size: 1.16 KB

Contents

# wrap find_template to search in ActiveScaffold paths when template is missing
module ActionView #:nodoc:
  class PathSet
    attr_accessor :active_scaffold_paths

    def find_template_with_active_scaffold(original_template_path, format = nil, html_fallback = true)
      begin
        find_template_without_active_scaffold(original_template_path, format, html_fallback)
      rescue MissingTemplate
        if active_scaffold_paths && original_template_path.include?('/')
          active_scaffold_paths.find_template_without_active_scaffold(original_template_path.split('/').last, format, html_fallback)
        else
          raise
        end
      end
    end
    alias_method_chain :find_template, :active_scaffold
  end
end

module ActionController #:nodoc:
  class Base
    def assign_names_with_active_scaffold
      assign_names_without_active_scaffold
      @template.view_paths.active_scaffold_paths = self.class.active_scaffold_paths if search_generic_view_paths?
    end
    alias_method_chain :assign_names, :active_scaffold

    def search_generic_view_paths?
      !self.is_a?(ActionMailer::Base) && self.class.action_methods.include?(self.action_name)
    end
  end
end

Version data entries

99 entries across 99 versions & 3 rubygems

Version Path
brisk-bills-0.8.2 vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
brisk-bills-0.8.1 vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.15 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.14 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.13 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.12 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.11 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.10 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.9 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.8 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.7 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.6 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.5 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.4 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.3 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.2 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.1 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.24.0 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.23.7 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
six-updater-web-0.23.6 lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb