Sha256: 2542db705078e0c19ec5a45439fa8e9d79eafccf99dfb2ebd63395c88e96ccd2

Contents?: true

Size: 743 Bytes

Versions: 6

Compression:

Stored size: 743 Bytes

Contents

Walruz.setup do |config|
  
  # All the models of ActiveRecord can behave as actors and subjects
  config.actors   = [ActiveRecord::Base]
  config.subjects = [ActiveRecord::Base]
  
  ActionController::Base.class_eval do
    
    rescue_from Walruz::NotAuthorized, :with => :unauthorized
    
    #
    # This method will be called when a user is not authorized. By
    # default it renders an unauthorized template on the public directory
    # with a HTTP status 401 (not authorized)
    # This method can be overwritted in childs of ActionController::Base
    # to have a better handling of unauthorized exceptions
    def unauthorized(e)
      render :file => "#{RAILS_ROOT}/public/unauthorized.html", :status => 401
    end
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
walruz-rails-0.0.11 rails_generators/templates/walruz_initializer.rb
walruz-rails-0.0.10 rails_generators/templates/walruz_initializer.rb
walruz-rails-0.0.9 rails_generators/templates/walruz_initializer.rb
walruz-rails-0.0.8 rails_generators/templates/walruz_initializer.rb
walruz-rails-0.0.4 rails_generators/templates/walruz_initializer.rb
walruz-rails-0.0.5 rails_generators/templates/walruz_initializer.rb