Module: SteelWheel::RailsHelpers::InstanceMethods

Defined in:
lib/steel_wheel/railtie.rb

Overview

rubocop:disable Style/Documentation

Instance Method Summary collapse

Instance Method Details

#failure_callbacks(handler) ⇒ Object



33
34
35
36
37
# File 'lib/steel_wheel/railtie.rb', line 33

def failure_callbacks(handler)
  handler.failure(:not_found) do
    render file: Rails.root.join('public', '404.html').to_s, status: handler.http_status
  end
end

#handler_class_for(handler) ⇒ Object



26
27
28
29
30
31
# File 'lib/steel_wheel/railtie.rb', line 26

def handler_class_for(handler)
  different_namespace = handler.to_s.split('/').size > 1
  return "#{handler.to_s.camelize}Handler".constantize if different_namespace

  "#{[params[:controller], handler].compact.join('/')}_handler".classify.constantize
end