Generate Models & Controllers from Ruby program

Hi All.

I would like to create a model, database, and controller (if possible)
from a webapp. Each model and controller will each have 4 methods, and
the database will always have the same number of fields. I will
probably create the database through create_table or a direct SQL
command.

My question is this - is there a method that I can call to create the
model and controllers? Would it be easier/simpler/cleaner/better/sexier
to have the current (main) model create dynamic methods? If so, how can
I do that?

Domo arigato in advance.

Lisa

lisa-u wrote:

Hi All.

I would like to create a model, database, and controller (if possible)
from a webapp. Each model and controller will each have 4 methods, and
the database will always have the same number of fields. I will
probably create the database through create_table or a direct SQL
command.

My question is this - is there a method that I can call to create the
model and controllers? Would it be easier/simpler/cleaner/better/sexier
to have the current (main) model create dynamic methods? If so, how can
I do that?

Domo arigato in advance.

Lisa

That seems like a very dangerous and scary thing to do. I suppose you
can use the backticks to execute command line operations but I wouldn’t
unless you have a VERY good reason.

But assuming you do have a very good reason, I think it works like this:

ruby script/generate controller hello_world index list show

not 100% sure though

Alex W. wrote:

That seems like a very dangerous and scary thing to do. I suppose you
can use the backticks to execute command line operations but I wouldn’t
unless you have a VERY good reason.

I figured as much, and I don’t think I have a good enough reason!

I will instead try to make dynamically created methods or generic
methods.

Thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs