enspiral/loomio — pull request #15 by craigambrose (2012-03-07 08:07:56+00:00)
Title: Some small controller and view refactorings

Nothing major here. I went through the controllers and views and picked out a few little things I thought could be improved.

There is possibly further room to tackle controllers further using more of inherited resources features. Scoping is not used much there at present, and could be used to replace some of the checks to see if a motion is in a group, group is accessible to user, etc.

Having said that, I did notice that the developers of inherited resources are now saying:

"Since Rails 3 came out, I have no longer used Inherited Resources. I have found that the responders abstraction and custom Rails generators offer the perfect balance between hiding and showing too much logic. That said, I suggest developers to make use of the responders gem (at github.com/plataformatec/responders) and no longer use Inherited Resources."

I'm not entirely sure I agree with them here. I still tend to use it. There is more on this idea on Jose's blog post here:

http://blog.plataformatec.com.br/2009/12/one-in-three-inherited-resources-has-scope-and-responders/

The other big win, as you've already identified Jon, would be to use cancan.

My only concern is that I think that the core features of Loomio would do well not to be too closely tied to the user authentication stuff. That's because while certainly one use of Loomio is a hosted app managing lots of groups, I think another interesting use would be to extract the guts of Loomio as a Rails Engine. Then, I could install the ability to make consensus decisions into other apps. I'm particularly thinking here of the Refinery CMS app we use at http://atamai.co.nz