I am just getting into Ruby on Rails. I come from a LAMP background, and
am throughly enjoying the ease of ROR.
I have set myself up to learn this through giving myself a small
project. Learn through experience which is the best way that I learn. I
am creating a small little accounting piece of software for myself.
So I have couple of questions I am hoping to get some ideas on how to
handle stuff in ROR that I am familiar with in PHP but not quite so in
this new environment.
So I have one set of scaffolding that handles what the debts that are
owed are. I have another set of scaffold that handles what payments have
What I want to do is to be able to tally up the payments that have been
made to a particular debt and then display them under the debts listing
to show what the new current total is.
So for example in the debts section:
$100 To someone
I then list in the payments area two payments for $20 each.
So then in the debts section I would like to now see
$60 To someone
I gather that whatever code I would need would go in the model?? But not
sure what it would look like.
Secondly I was wondering how I would generate a global variable in ROR.
I have scaffolding for a set of pay periods. I want to be able to set
one as the current period. Now when I go into the payments section, I
would like to have the current pay period display in a drop down list.
I am figuring having that pay period that is current be set like a
global variable then reading it in the form scaffolding for the
payments. But I am thinking there is a different way of doing this in
ROR. Just looking for some guidance here.