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 -- Posted via http://www.ruby-forum.com/.
Alex Wayne
2006-Jun-23 20:26 UTC
[Rails] Re: Generate Models & Controllers from Ruby program
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. > > LisaThat 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 -- Posted via http://www.ruby-forum.com/.
Alex Wayne 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! -- Posted via http://www.ruby-forum.com/.