Call task more than once in Rails 3 generator
- by balexand
I'm writing a Rails 3 generator that creates two different models. Here's a very simplified example of what I'm trying to do:
def my_generator_task
invoke "model", ["foo"]
invoke "model", ["bar"]
end
The problem is that the Thor invoke method only invokes a task once, so the second call to the "model" task never happens and the "bar" model is never created. Does anyone know an elegant way to accomplish this, preferably in a way that doesn't break the ability to run "rails destroy" with the generator?