Wai T. wrote:
Tony M. wrote:
What I would like to do at this point is copy a few
attributes(lname, fname, signature, phone) to a table called receipts?
I’ve already created a relationship between addpackages and receipts, I
just need help with coding behind this operation. I figure I would
perform this operation in the addpackage controller under “def edit” but
I really need a kick start to coding this or someone to tell me this is
the correct way to do it.
It would really help if you could give us the relationships between the
models. From my understanding, you are trying to copy the fields from
one table to another right? In that case, you can look up the package
record in the receipt model and copy the attributes to the current
I think we are on the same page, but here’s a visual representation just
1: The ID# is clicked when a user comes to the mailroom to get their
2: The app will prompt for the users initials
3: Upon clicking the Sign for package, the initials/date are logged, and
what I want to happen is to copy all all fields needed to fill this
following Receipts table, and at the same time delete the selected
record from Inventory, as the package has been picked up and it is no
longer in the mailroom.
Here are my relations at the moment:
class Addpackage < ActiveRecord::Base
class Receipt < ActiveRecord::Base
I’ve been trying to do this operation from both the addpackage
controller and receipt controller but have failed. I’m still a newbie
to rails so it might just be my syntax or incomplete knowledge. You
said above I could perform all these operations from receipt.db model?
I have never put anything but relations in those.
Anyway I have exhausted myself trying to get this to work. I’ll keep
hacking at it, but im not getting much of anywhere.