I asked this on Stack Overflow and was told this is a better place to ask.
I am build a rails app that has the following models*:
User -name,password etc. -has_many :regions -has_many :reports Report -has_many :records -belongs_to :user -belongs_to :region Record -belongs_to :report -item1 :integer -item2 :integer ...
The report represents a set of records, while each record represents how many items of each type were processed by someone. (the "someone" is a string, not an entity in the db).
Now what I need is to give a user the ability to see a report of how many items were processed between specific dates and specific regions.
for example: between 01.13 and 02.13 in region A and region C there were 13 item1 processed, 123 item2 processed, and 432 item3 processed. (the user chooses which regions he needs the reports for)
More ever he should be able to see the report only for the regions he has, not for all the regions (of course I could make a listbox that shows only the regions the user has, but it does not seem very secure).
How do I accomplish this task?
*Please note that the model name "Report" has nothing to do with the report I am trying to generate, its just the word with the correct semantic meaning.