I’m new to Rails, but have used similar frameworks. I’m trying to find
out if it’s possible to specify associations from the command line
when creating models . So far, I’ve only seen an example of specifying
“references” as follows, which places a “belongs_to” association on
rails generate model Comment commenter:string body:text
My group uses Enterprise Architect (EA) to design the logical models
for our applications. This allows us to focus closely on our domain
before ever working on code. Once we’re happy with the domain model,
we use custom tools to generate applications, thus avoiding lots of
I’ve been extending our tool to convert the EA XMI logical model into
scripts that can generate applications for Grails, Spring Roo and RoR.
So far, Roo has the best command line support for associations and
I’ve created my own extension for Grails to support this. Now, I’m now
working on RoR.
I would appreciate any pointers as to how I can extend the current
ActiveRecord / Rails code to add the ability to define the standard
‘has_one’, ‘has_many’ and ‘has_and_belongs_to_many’. Due to my
inexperience with RoR I’m hitting a roadblock when attempting to find
where the “references” is handled by the model generator.