Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > why doesn't this "belongs_to" line of code, using options override,not work??? (need help using belongs_to with options)

Reply
Thread Tools

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

 
 
Greg Hauptmann
Guest
Posts: n/a
 
      10-30-2008
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
 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      10-30-2008
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/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
self referential belongs_to Aryk Grosz Ruby 0 06-26-2008 03:39 AM
good compile options for g++ options to enforce good coding Cliff Martin C++ 1 01-31-2007 02:03 AM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
is belongs_to :through supported? dave.new Ruby 0 05-22-2006 01:53 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57