educative.io

Educative

Difference between Rails g model # rails g scaffold

Hi folks. I’m new in rails and web developement, I wan to know if there is the difference between writting rails g model and rails g scaffold . If so, what make them differents or if not, what is the best one to use?

The scaffold is easier, quicker, and everything is preconfigured for you.

On the other side, the benefits of generating models independently of scaffolds are that you have maximum control over your app working and interface, you can employ Behaviour-Driven or Test Driven Development, and you can reuse this code or add more features to it in the future.

Scaffolding is very helpful for new Rails users.