Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   why doesn't this "belongs_to" line of code, using options override,not work??? (need help using belongs_to with options) (http://www.velocityreviews.com/forums/t853922-why-doesnt-this-belongs_to-line-of-code-using-options-override-not-work-need-help-using-belongs_to-with-options.html)

Greg Hauptmann 10-30-2008 09:21 PM

why doesn't this "belongs_to" line of code, using options override,not work??? (need help using belongs_to with options)
 
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

Brian Candler 10-30-2008 10:44 PM

Re: why doesn't this "belongs_to" line of code, using optionsoverride, not work??? (need help using
 
Suggest you try http://rubyonrails.com/community

ActiveRecord is a sufficiently large project in its own right that it
has its own mailing lists, and you're more likely to find experts there.
--
Posted via http://www.ruby-forum.com/.



All times are GMT. The time now is 07:11 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.