Open narup opened 10 months ago
Hi, The solution you suggest looks good. If you want to work on a PR we can accept it.
Note: As far as I know, in Rails -- they direct you to do this kind of customization via editing the migration file, so they do not provide a solution via CLI generator. But the solution you suggest looks interesting, so I think it can be good.
@narup did you get a chance to work on a PR for your suggestion? anything I can help with?
@jondot If @narup hasn't started working on it, I'll like to give it a shot. I dived a bit into the source yesterday and I think I know where and how to fix this.
Coud be nice to have this feature. Is anyone working on it?
Feature Request
For a generate model command such as -
cargo loco generate model posts title:string! content:text user:references
it would be good to allow some syntax to have a different field name foruser
. Right now, it generates user_id column name but what if I want to generate something likeowner_id
so that I can have multiple references to theusers
table such asrequester_id
all referencing the users tableSomething like?
cargo loco generate model posts title:string! content:text user:requester_id:references
?Describe alternatives you've considered For now, I am just using a different migration to rename the column but default support on the cli command itself would be useful
I can try to raise a PR if this is desired