Hello,
I have 2 legacy tables I want to join:
DB TABLES
Transaction_Details
Accounts
I want to join Transaction_Detail.Account with Accounts.Account.
I also want to be able to select Transaction_Details based on a field in
the Accounts table. Is that possible? I’m thinking it should be.
I’d prefer to do it with Active Record, as opposed to find_by_sql.
I currently have:
MODELS
-
transaction_detail.rb -
class Transaction_Detail < ActiveRecord::Base
set_table_name “Transaction_Details”has_one :account
end -
account.rb -
class Account < ActiveRecord::Base
set_table_name “Accounts”
has_many :transaction_details
end
CONTROLLER
TransactionDetail.find(:all) … not sure what to do about the
:conditions here
Thanks!