Duplicating table data into another table

Requirement: I am designing a Customer invoice system for a service
company. company has some default rates across the company which is
based on designation, experience level, qualification etc. These rates
can be changed for a particular project. So project rates can overwrites
the default rates

The way I am doing is:

  1. create defaultrates tables which will be pre-populated with the
    default rate data
  2. Project table contain information about project
  3. projectrates table which contain exactly same fields as defaultrates
    table, except it will also contain foreign keys with project table (id)
    and defaultrates table(id).
    When the project is created projectrates table will be populated with
    all the data present in defaultrates table along with project_id
    If user want to change the rates for a particular project, then
    projectrates table will be edited matching the particular project id

models:
project
has_many :projectrates

projectrate

belongs_to :project
belongs_to :defaultrate

defaultrate
has_many :projectrates

Questions

  1. User will create the project, at back-end projectrates table should
    be populated with the data from defaultrates table along with
    project-id. how to do this??
  2. show.rhtml , showing details of particular project should also show
    the details of project rates
  3. edit.rhtml editing project, should also give user the functionality
    to edit project rates

Please it is important for me, so let me know how to do this?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs