Creating DB views in Ruby on Rails

Posted by Zigu on Stack Overflow See other posts from Stack Overflow or by Zigu
Published on 2010-03-15T17:46:09Z Indexed on 2010/03/15 18:19 UTC
Read the original article Hit count: 171

Filed under:
|

Hey guys,

I'm building a "reports" functionality to a project.

3 roles here:

1) Volunteers (they report what hours they volunteered)

2) Supervisors (they look at the reported stuff, note: one supervisor can view all projects)

3) Projects (Represents a work project that some collection of volunteers work on)

To explain what it does:

A report will be specified by the supervisor to generate based on a query of what he needs.

These could be plausible reports:

1) The total number of volunteers, and the total amount of volunteer hours on this project

2) All the volunteer's names and emails associated with a project

3) The number of active projects vs. the total number of projects

I was thinking maybe that creating a view in rails and storing the name of that view so Rails will just check the view whenever a supervisor wants to pull up the "report".

Is a view really the answer or is it better to just save a query?

Can Rails do this or is there an even better or more simple way of achieving this functionality?

Cheers, -Jeremiah Tantongco

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about design