I have a table (ded_masts) that contains all the deductions (and their
parameters/characteristics) that a client (company) has instantiated/
authorized - the "parent table". Each employee of the company has
records in the child table - deducts - that correspond to the
authorized company-level deductions in ded_masts. On recording a new
employee, I need to query the ded_masts table and record them in the
deducts table and then allow editing.
In the legacy system, we query the ded_masts table for all allowed
deductions for that company, then iterate through the query creating
and saving the employee level deduction records (it is NOT a trigger
for several reasons).
In Rails, I've tried this in the deducts_controller:
@dedmasts = DedMast.find(:all, :conditions => ["client_id = ?",
for DedMast in @dedmasts
@dname = @DedMast.long_name
@sname = @dname[0, 9]
@deduct = Deduct.new
@deduct.client_id = params[:clientid]
@deduct.ee_id = params[:neweeid]
@deduct.precedence = @DedMast.precedence
@deduct.code = @DedMast.code
@deduct.name = @sname
@deduct.ach_allowed = @DedMast.ach_allowed
But I get various errors about loading constants and unexpected ends.
Is it not possible to access a model from another model's controller?