Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on rails without using scaffold and generator?

I am new user to ruby on rails. I have some question please give the answer as early as possible

1) Is it possible to create web application without using *rails new application_name* command? means creating required folder and file manually?

2) I want to create application without using scaffold and generator, so everything is created manually...I searched but not get a link to do it...

like image 421
user3048147 Avatar asked Jan 25 '26 06:01

user3048147


1 Answers

You really should be using rails new (appname) to generate your project directory.

From there, you do not need to generate a scaffold. If you want to go slightly less abstract and create some things manually you can use rails generate resource (resource name).

If you want to go even less abstract then that, you can use rails generate model (model name) and rails generate controller (controller name) and rails generate migration (migration name). Within this level of abstraction, you can specify options such as methods you want the model to have or columns you want the migration to add.

And the least abstract(most manual) would be if you make these files yourself (like actually going in and creating new folders/files for models, controllers, etc.)

So on an order from most abstract to least:
1) generate scaffold
2) generate resource
3) generate model/controller/migration
4) creating the files/folders without rails

Most developers are usually working with the #2, #3, or #4 layers (remember it is always a tradeoff between eliminating a lot of time off by not having to manually create the same code over and over again and flexibility).

like image 140
JaTo Avatar answered Jan 27 '26 22:01

JaTo