Home > Mobile >  How I can use param in url without creating table in database
How I can use param in url without creating table in database

Time:08-20

I have a controller that works without a table in the database. At the moment, there is an action index that performs a request to the api from which it performs the action. Route looks like /car_collector.

And my question is how to create a route /car_collector/:id/edit without creating table in database.

Just creating a route get '/car_collector/:id/edit', to: 'car_collector#edit', as: 'edit_doc_collector', param: :id an error is generated ActiveRecord::StatementInvalid in Admin::CarCollectorController#edit

CodePudding user response:

resources :car_collector, only: :edit

That's it, you don't need do sometning extra

After that just go to /car_collector/1/edit, /car_collector/2/edit etc.

Default param will be as params[:id]

  • Related