Why do Ruby on Rails professionals NOT use Scaffolding?

后端 未结 8 1203
梦毁少年i
梦毁少年i 2020-12-04 09:59

I read sometimes from people that seem to be working with rails since longer, that one important lesson they learnt would be \"Don\'t use scaffolding\". Also on irc I read c

8条回答
  •  有刺的猬
    2020-12-04 10:14

    People thus far have said that experienced rails programmers don't use scaffolding, and for good reasons mainly. I advocate that beginners don't use scaffolding either.

    You may have been plodding along happily for some time with scaffolding, and then you realise that you forgot to include the published boolean field for your Post model, so you generate a migration to add the attribute to the table (you've managed to work that out). You then also have to work out how to add that to the form that scaffold produced. Then for the life of you you can't work out why it's not updating when you submit your form, and after much strife and wasted time you figure out you haven't permitted mass assignment on that attribute like scaffold did for you on the others. Turns out you don't really know anything about how Rails works.

    If you're learning Rails, you'd understand much more about MVC if you built the M the V and C yourself.

提交回复
热议问题