Sha256: 139844bcc66e0ac52fdf150ef7b51e944f718df31df2ec753952422e717972ed

Contents?: true

Size: 875 Bytes

Versions: 29

Compression:

Stored size: 875 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, path=self.controller_path)
        if self.class.scoped_views?
          begin
            render :template => "#{devise_mapping.scoped_path}/#{path.split("/").last}/#{action}"
          rescue ActionView::MissingTemplate
            render :template => "#{path}/#{action}"
          end
        else
          render :template => "#{path}/#{action}"
        end
      end
    end
  end
end

Version data entries

29 entries across 28 versions & 4 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/devise-1.5.4/lib/devise/controllers/scoped_views.rb
devise_sociable-0.1.0 vendor/bundle/gems/devise-1.2.1/lib/devise/controllers/scoped_views.rb
devise-1.5.4 lib/devise/controllers/scoped_views.rb
devise-2.0.0.rc lib/devise/controllers/scoped_views.rb
devise-1.5.3 lib/devise/controllers/scoped_views.rb
cloudfoundry-devise-1.5.2 lib/devise/controllers/scoped_views.rb
devise-1.5.2 lib/devise/controllers/scoped_views.rb
devise-1.5.1 lib/devise/controllers/scoped_views.rb
devise-1.5.0 lib/devise/controllers/scoped_views.rb
devise-1.5.0.rc1 lib/devise/controllers/scoped_views.rb
devise-1.4.9 lib/devise/controllers/scoped_views.rb
devise-1.4.8 lib/devise/controllers/scoped_views.rb
devise-1.4.7 lib/devise/controllers/scoped_views.rb
devise-1.4.5 lib/devise/controllers/scoped_views.rb
devise-1.4.3 lib/devise/controllers/scoped_views.rb
devise-1.4.2 lib/devise/controllers/scoped_views.rb
devise-1.4.1 lib/devise/controllers/scoped_views.rb
devise-1.3.4 lib/devise/controllers/scoped_views.rb
devise-1.3.3 lib/devise/controllers/scoped_views.rb
devise-1.3.2 lib/devise/controllers/scoped_views.rb