On Mon, Mar 28, 2011 at 9:53 PM, Ankur <[email protected]> wrote:
> Otherwise you would have to store it in a separate Model. > Thinking of adopting the same approach. > > 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. > I have not defined the relationship that way. Will go with creating a separate model for the ratio. But than, how do we get the report data in the ratio model (please excuse me I am an absolute RoR beginner). > > 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. > > -- 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.
