Number of scaffolds (Controllers)

Hi
Is it a problem in rails application development to have many
scaffolds ( Specially because of its controllers) ? I know the word
“many” depends on the project, but it can be meaningful in general
speaking. This problem can be discussed in two part, one of them is
from the point of view of software development methods. And the more
important one, is the performance. Does it affect application
performance?

melomane wrote:

Hi
Is it a problem in rails application development to have many
scaffolds ( Specially because of its controllers) ? I know the word
“many” depends on the project, but it can be meaningful in general
speaking. This problem can be discussed in two part, one of them is
from the point of view of software development methods. And the more
important one, is the performance. Does it affect application
performance?

WRT performance
A larger number of controllers will require a larger number of routes,
and both of these things will take up a little more memory. However i
would say that this won’t be in your top twenty performance issues to
tackle. That is unless you’re procedurally generating hundreds of them
or something. Your optimisation opportunities will involve improving
your db queries for example.

WRT methodology
I’d say that it’s better to have more controllers, each of which deals
with a specific resource in a restful and simple way, than it is to have
a small number of controllers doing more complicated things, with more
models etc. In all software, a large number of simple things (whether
it’s classes or methods or whatever) beats a small number of complicated
things IMO.

And you can use :only and :except options to generate only the required
routes

ex.
map.resources :users, :only => [:index, :show]

map.resources :users, :only => [:update]

Sijo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs