Sha256: 1e50d6777c67fbc76603efdba5d79ff57596096002fefee8cf86bb92b277efae
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
ModelInfo::Engine.routes.draw do root to: 'models#index' namespace :api do namespace :v1 do Rails.application.eager_load! model_names = ActiveRecord::Base.descendants.collect { |model| model.to_s if model.table_exists? }.compact model_names.delete('ActiveStorage::Blob') model_names.delete('ActiveStorage::Attachment') model_names = model_names.map(&:pluralize).map(&:downcase) model_names.each do |model| get model, to: 'models#index' post model, to: 'models#create' get "#{model}/:id", to: 'models#show' put "#{model}/:id", to: 'models#update' delete "#{model}/:id", to: 'models#destroy' end end end get 'models', to: 'models#index' get 'model_new', to: 'models#new' post 'model_create', to: 'models#create' get 'model_show', to: 'models#show' get 'model_edit', to: 'models#edit' patch 'model_update', to: 'models#update' delete 'model_destroy', to: 'models#destroy' get 'associations_index', to: 'associations#index' get 'association_new', to: 'associations#new' post 'association_create', to: 'associations#create' get 'association_show', to: 'associations#show' get 'association_edit', to: 'associations#edit' patch 'association_update', to: 'associations#update' delete 'association_destroy', to: 'associations#destroy' get 'download_csv', to: 'downloads#download_csv' get 'download_json', to: 'downloads#download_json' get 'download_xml', to: 'downloads#download_xml' end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
model_info-1.0.0 | config/routes.rb |
model_info-0.0.9 | config/routes.rb |