haml / haml-rails

let your Gemfile do the talking
MIT License
1.04k stars 169 forks source link

use rails helpers for resource routes #186

Open phoffer opened 1 year ago

phoffer commented 1 year ago

I encountered some issues when using Rails scaffolding with a model name/namespace that didn't match up. Ie. scaffolding admin routes for some resources like this:

rails generate scaffold admin/user name:string --model-name="User"

This should generate everything using a User model, but with routing that follows admin_user* naming pattern. However, the templates would generate links with user* for paths.

This updates the templates to use the rest of the routing helpers Rails provides, and also includes a handler for the form target url, only if necessary.