2

I want to make small cinema booking system as my school project and i think when i should generate only model?
My database got:

  1. tickets
  2. seances
  3. halls
  4. customers
  5. prices
  6. genres
  7. movies.

Im using activeadmin, so in example do i need to generate controler for movies if i manage movies only from activeadmin?

2 Answers2

1

I usually use scaffold only for quick mockups, when I need to build something simple and show it someone or test something. For real applications I prefer to do everything manually, because anyway you end up removing all the template stuff. If there's no need in a separate controller and, therefore, views then of course you don't need scaffolds. But if you generate them, you can easily remove them – just see the list of generated files and remove those you don't need.

If you manage movies only from admin panel and you're not going to have separate views for them, then no, you don't need another controller.

Jeiwan
  • 954
  • 6
  • 13
  • I can simplify it so I will create a controller only for those classes for which I need a view? – dfasofjoaishoiqw4e Dec 13 '15 at 15:56
  • Yep, all controllers do is just rendering of views. If you need no views, then you need no controller (but controller are also classes). Also consider @Marv-C answer. Scaffolds might harm in the beginning as they do some job for you and you're risking skip some important understandings about Rails. – Jeiwan Dec 13 '15 at 16:01
1

For learning purpose, i usually try to avoid doing scaffold and just try to code the CRUD functionality on my own. I use scaffold for reference though. If you're new to using rails i suggest avoid scaffold for now til you get a good grasp on how Active Record works. you can find a good here: http://guides.rubyonrails.org/active_record_basics.html

mrvncaragay
  • 1,240
  • 1
  • 8
  • 15