I'm switching from using a laravel php framework to a rails framework and cannot figure out how to get nested routes working in rails like it did in laravel. In laravel it would work like this:
Route::group(['prefix' => 'healthandwelness'], function() {
Route::get('', [
'uses' => 'healthandwelness@index'
]);
Route::group(['prefix' => 'healthcare'], function() {
Route::get('', [
'uses' => 'healthcare@index'
]);
Route::get('{article_id}', [
'uses' => 'article@index'
]);
]);
});
Which would give me the routes:
/healthandwellness
/healthandwellness/healthcare
/healthandwellness/healthcare/{article_id}
The only way I've seen to nest routes in rails is with resources which I've used to tried and recreate my routes in rails like this:
resources :healthandwellness do
resources :healthcare
end
But the nature of resources makes this route into the following gets:
/healthandwellness
/healthandwellness/:health_and_wellness_id/healthcare
/healthandwellness/:health_and_wellness_id/healthcare/:id
Is there anyway to do what I am looking for in rails and recreate what I was able to do laravel?