why doesn't this "belongs_to" line of code, using options override,not work??? (need help using belo

G

Greg Hauptmann

Hi,

Anyone able to help out in how you use "belongs_to" options so that I
can have a 2nd attribute that also belongs to an associated table. My
recurring items class belongs to a "transaction", however I also want
a secondary recurring item field "journal_source_id" to be able to
reference a "bank_account" item.

The following doesn't quite seem to work?
-----------------
belongs_to :journal_source, # I made this name up, i.e. it isn't
actually in a table. It's the "journal_source_id" field that is in
the recurring table
:class_name => "BankAccount",
:foreign_key => "journal_source_id"
---------------



Background below:

---- recurring class ----
belongs_to :bank_account # recurrance associated with bank account
belongs_to :journal_source, # HELP ME HERE: Want to have another
reference to a "bank acount" here
:class_name => "BankAccount",
:foreign_key => "journal_source_id"

-- recurrings table ----
# id :integer(4) not null, primary key
# bank_account_id :integer(4) not null
# journal_source_id :integer(4) <==== THIS IS THE ONE

---- bankaccounts table ----
id
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top