class Rails::Mongoid::Railtie
Hooks Mongoid
into Rails
3 and higher.
@since 2.0.0
Public Class Methods
rescue_responses()
click to toggle source
Mapping of rescued exceptions to HTTP responses
@example
railtie.rescue_responses
@ return [Hash] rescued responses
@since 2.4.3
# File lib/mongoid/railtie.rb, line 23 def self.rescue_responses { "Mongoid::Errors::DocumentNotFound" => :not_found, "Mongoid::Errors::Validations" => 422 } end
Public Instance Methods
handle_configuration_error(e)
click to toggle source
Rails
runs all initializers first before getting into any generator code, so we have no way in the intitializer to know if we are generating a mongoid.yml. So instead of failing, we catch all the errors and print them out.
@since 3.0.0
# File lib/mongoid/railtie.rb, line 103 def handle_configuration_error(e) puts "There is a configuration error with the current mongoid.yml." puts e.message end