ruby on rails 3 - Programmatically invoking active_record generator: how to pass the parent argument? -


the parent argument ignored, in of these cases:

rails::generators.invoke("active_record:model", [name, ["list_order:string", "name:string"], ["parent=ecm::toplist::base"]]) rails::generators.invoke("active_record:model", [name, ["list_order:string", "name:string"], ["--parent=ecm::toplist::base"]]) rails::generators.invoke("active_record:model", [name, ["list_order:string", "name:string"], "parent=ecm::toplist::base"]) rails::generators.invoke("active_record:model", [name, ["list_order:string", "name:string"], "--parent=ecm::toplist::base"]) 

is bug, or missing something?

correct way be

rails::generators.invoke("active_record:model", [name, "list_order:string", "name:string"], { parent: "ecm::toplist::base"}) 

but careful, according this once specify :parent, migration not invoked.

the correct way generate model migration be

rails::generators.invoke("active_record:model", [name, "list_order:string", "name:string"], {migration: true, timestamps: true}) 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -