How would a 'report' fit into MVC ? A design pattern question.

N

Nate Murray

Greetings. I am writing a phone call tracking app, so I have a model
'calls'. What I want to do is have some reporting about those calls,
but I'm not sure what the best practice is for something like a report
as it relates to the MVC pattern. It's not really an ActiveRecord
because it doesn't have any persistent data. Should I implement a
Report model object that is created for reporting? Or is this something
that should be implemented between helpers and views? ( That is to ask,
should I put the report logic in its own helper module? )

If I choose to go the 'report model' route. Am I wrong in assuming that
I probably shouldn't even start with rails' 'generate' scripts ( as the
report wouldnt have tradition ties to a database ) ? I would think that
something like this would best be built from the ground up.

As you can tell, Im farely new to rails. Thanks for any help!

-Nate
 
E

Erik Hollensbe

Greetings. I am writing a phone call tracking app, so I have a model
'calls'. What I want to do is have some reporting about those calls,
but I'm not sure what the best practice is for something like a report
as it relates to the MVC pattern. It's not really an ActiveRecord
because it doesn't have any persistent data. Should I implement a
Report model object that is created for reporting? Or is this something
that should be implemented between helpers and views? ( That is to ask,
should I put the report logic in its own helper module? )

Someone will undoubtedly say I'm wrong, but this is my opinion:

Your view would be the visualization of the report, e.g, tables, charts, etc.

Your model would be the data generated from the processing the
parameters (static and dynamic).

Your controller, if any, would be the parameters that the report would
be generated from.


If I choose to go the 'report model' route. Am I wrong in assuming that
I probably shouldn't even start with rails' 'generate' scripts ( as the
report wouldnt have tradition ties to a database ) ? I would think that
something like this would best be built from the ground up.

There is no requirement to use activerecord in any part of rails,
although it will make testing tough.

HTH,

-Erik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top