Sounds like the ratio is not attached to a report, but rather is a
separate calculation attached to a bird , location and report.

My initial idea would be to have it purely dynamic.  Make a library
which would calculate this based on each display.  Then you can cache
it so it only gets calculated once every 5 min (example).  Because it
is different for each bird and each location, correct?

Otherwise you would have to store it in a separate Model.

Also are you doing Bird belongs to many locations through report?
Does that make sense?  Even if you do that you don't want to store the
ratio with the report because it would be duplicated.

This image was very helpful for me.
http://dl.dropbox.com/u/766146/ruby-on-rails-data-relationships.png

I found it on the internet somewhere and copied to my dropbox.

Ankur


On Mar 27, 10:23 am, Kaustubh Naik <[email protected]> wrote:
> On Sat, Mar 26, 2011 at 4:26 AM, Matt Jones <[email protected]> wrote:
> > I'm not quite sure what you mean - row and record counts of what? It'll be
> > a lot easier to help if we have a clearer idea of what your models are and
> > how they're related.
>
> Extremely sorry for the inadequate information provided. Here is what I want
> to do
> I have three models namely Bird, Location and Report!
>
> The report is model looks like this
>
> class Report < ActiveRecord::Base
>
>   hobo_model # Don't put anything above this
>
>   fields do
>     Date    :date
>     #Plumage :string
> Plumage enum_string(:Breeding, :NonBreeding )
>     #Weather :string
> Weather enum_string(:Cloudy, :Sunny, :Humid)
>     RAIndex :integer
>     Time enum_string(:Dawn, :Morning, :Noon, :Evening, :Dusk, :Night)
>     timestamps
>   end
> belongs_to :bird
> belongs_to :location
>
> The field RA Index is a value assigned with each bird specie. It is the
> ratio of number of reports in which 'X' bird is reported at 'P' location to
> the number total reports for that location. I need to calculate that Index.
> Please guide me through.
>
>
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Hobo Users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/hobousers?hl=en.
>
> --
> Kaustubh Naik
> Goa-India
>
> http://geekblues.in/
> [email protected]

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to