Creating DB views in Ruby on Rails
- by Zigu
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