Displaying 6 results from an estimated 6 matches for "billing_address_id".
2006 Apr 04
4
Aggregating two objects of the same type
I would like to have a customer that has references to two addresses,
a billing address and a shipping address. In a non-rails environment
I would have two keys in the customers table, billing_address_id and
shipping_address_id to reference the addresses. It appears that
ActiveRecord expects the parent id to reside in the child table,
regardless of whether the relationship is one-to-one or one-to-many.
What would the best approach be to persist this type of data
structure? I would prefer to avoi...
2006 Nov 04
0
Check_box woes
...;
<dd><%= u.text_field :first_name, :size => "30" %></dd>
<dt><label for="last_name">Last name:</label></dt>
<dd><%= u.text_field :last_name, :size => "30" %></dd>
<dt><label for="billing_address_id">Billing address?:</label></dt>
<dd><%= u.check_box :billing_address_id, {}, @address.id, nil %></dd>
<dt><label for="shipping_address_id">Shipping address?:</label></dt>
<dd><%= u.check_box :shipping_address_id...
2006 Apr 08
2
one-to-one relationship confusion
...so I would really like to avoid putting the
keys referencing the customer or other objects in the addresses table.
Addresses are exclusively referenced by parent objects and a
many-to-many association is not appropriate.
Ideally I would like the customers table to use a shipping_address_id
and a billing_address_id to reference the aggregate addresses. For
illustration purposes, another object, company might have a
main_address_id, an after_hours_address_id and a weekend_address_id.
In order to keep the keys in the customer table the belongs_to
statements are in the customer model and the has_one statement...
2006 Jun 03
8
confused about ActiveRecord relationships
I am very confused about where to put the belongs_to and the has_one
(and other relationship identifiers). I have read the RDoc and the
agile book many times about this and I think i still see it backwards.
Let me outline my app so you have an understanding...
I have 2 tables:
Schools { id, school_name, address_id }
and
Addresses { street1, street2, city, state, zip, country }
*** this
2006 Aug 02
3
Data relationships for e-commerce: users, orders, addresses
Hi there
I''m in the process of developing an e-commerce Rails app but am
getting a little stuck on what models I should be working with on the
order/checkout side of things.
The app requires users to be registered and authenticated to checkout.
So I already have a User model and an Order model (which belongs to a
User). The Order model is largely similar to that used in the Agile
Rails
2010 May 10
7
NilClass passed to partial view
Hi,
I have a simple program that tries to do something really basic.
First, I have a company Model :
-------------------------------------
class Company < ActiveRecord::Base
has_one :billingAddress, :foreign_key=>"id", :class_name=>"Address"
end
Then I have the address Model :
--------------------------------------
class Address< ActiveRecord::Base
belongs_to