Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/routes.rb

Instance Method Summary collapse

Instance Method Details

#crud(*options, &block) ⇒ Object



4
5
6
7
# File 'lib/rails/routes.rb', line 4

def crud(*options, &block)
  options << { except: %w(new edit), defaults: { format: :json } }
  resources(*options, &block)
end

#mount_openapi_documentationObject



9
10
11
# File 'lib/rails/routes.rb', line 9

def mount_openapi_documentation
  get :openapi, to: 'openapi#index'
end

#mount_openapi_specification(options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/rails/routes.rb', line 13

def mount_openapi_specification(options={})
  name = options[:name] || :default
  get :spec, to: '/openapi#spec',
             defaults: { format: :json, name: name }
end