ruby-on-railsamortization

Ruby on Rails Loan Amortization Schedule


What would be the best way to incorporate a loan amortization schedule in my rails app? Is it possible? Is ruby on rails even a good way to implement something like that? I have built them in excel a few times before, but just can't picture how to do it in rails.


Solution

  • This all depends on the actions your users will need to perform on/with the schedule.

    If your goal is simply displaying the schedule, there's no need to persist the entire array of dates/payments/etc. Simply store a start/end date, payment interval, loan amount, interest rate and the payment amount. It isn't heavy work to construct the actual schedule given this information.

    If your users should be able to annotate specific items within the schedule, then consider which properties of each item would make good unique identifiers (hint: loan + item date). From there, your models should flesh out easily:

    class ScheduleItem
    {
      date dueDate;
      float paymentAmount;
      string annotations;
      bool isPaid;
      ...
    }
    
    
    class Schedule
    {
      int loanId;
      date startDate;
      date endDate;
      ...
    }
    

    If you do decide you need models (to persist or just to generate views) representing the schedule start with the simplest implementation possible and expand from there. You're most likely having trouble getting started because you're trying to incorporate every variable from the start. Keep it simple. Get things rolling.