Sha256: d8ad79df41d63a480a506c6b1be0e64e77f2887e5f8651202e516e48f572bc3b

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

module Devise
  module Controllers
    module ScopedViews
      extend ActiveSupport::Concern

      module ClassMethods
        def scoped_views?
          defined?(@scoped_views) ? @scoped_views : Devise.scoped_views
        end

        def scoped_views=(value)
          @scoped_views = value
        end
      end

    protected

      # Render a view for the specified scope. Turned off by default.
      # Accepts just :controller as option.
      def render_with_scope(action, options={})
        controller_name = options.delete(:controller) || self.controller_name

        if self.class.scoped_views?
          begin
            render :template => "#{devise_mapping.as}/#{controller_name}/#{action}"
          rescue ActionView::MissingTemplate
            render :template => "#{controller_path}/#{action}"
          end
        else
          render :template => "#{controller_path}/#{action}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise-1.1.rc0 lib/devise/controllers/scoped_views.rb