Sha256: cb2d164a7169a5888f49173befae4350d32b1af2eac7e716d2807e7dc0ff2768

Contents?: true

Size: 951 Bytes

Versions: 13

Compression:

Stored size: 951 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.plural}/#{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

13 entries across 13 versions & 2 rubygems

Version Path
devise-1.1.9 lib/devise/controllers/scoped_views.rb
devise-1.1.8 lib/devise/controllers/scoped_views.rb
devise-1.1.7 lib/devise/controllers/scoped_views.rb
devise-1.1.6 lib/devise/controllers/scoped_views.rb
devise-1.1.5 lib/devise/controllers/scoped_views.rb
devise-1.1.4 lib/devise/controllers/scoped_views.rb
devise-1.1.3 lib/devise/controllers/scoped_views.rb
devise-1.1.2 lib/devise/controllers/scoped_views.rb
devise-1.1.1 lib/devise/controllers/scoped_views.rb
devise-1.1.0 lib/devise/controllers/scoped_views.rb
namxam-devise-1.1.0.win lib/devise/controllers/scoped_views.rb
devise-1.1.rc2 lib/devise/controllers/scoped_views.rb
devise-1.1.rc1 lib/devise/controllers/scoped_views.rb