Displaying 11 results from an estimated 11 matches for "shipping_addresses".
Did you mean:
shipping_address
2009 Jun 24
1
accepts_nested_attributes_for :reject_if issue
I have the following models:
class Order < ActiveRecord::Base
belongs_to :billing_address
belongs_to :shipping_address
accepts_nested_attributes_for :billing_address
accepts_nested_attributes_for :shipping_address, :reject_if => proc {
|attributes| attributes[''has_shipping_address''] != ''1'' }
def after_initialize
self.build_billing_address
2007 Nov 20
2
confirming that a model instance was correctly created from POST params
I''m wondering whether I''m wasting my time trying to verify that an addition I''ve made to legacy code is in fact setting a new attribute on a model.
Substruct''s (http://dev.subimage.com/projects/substruct) OrderHelper contains this method:
1 def create_order_from_post
2 @use_separate_shipping_address = params[:use_separate_shipping_address]
2006 Jun 01
4
how can I control when to commit a transaction?
hello
it seems like this question has appeared a few times with no answer:
how do you get rails to issue ''write'' statements (ie ''CREATE/UPDATE'') to
the database without committing each time?
I tried setting
ActiveRecord::Base.connection.begin_db_transaction
before calling any action on my object, but as soon as
myObject.save
or
myObject.update
is called,
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
2009 Feb 26
1
composed_of, aggregate object isn't saved
I am relatively new to rails and I cannot figure out what is going on
here. I am using the composed_of method in an ActiveRecord class to
create two aggregate properties: shipping_address and billing_address.
The object properties are getting populated from the form and validation
is working - no problem. When I call order.save, though, everything is
being saved except the address fields. I am not
2006 Jun 06
1
Please Help with single table inheritance relationships
I''ve been searching the web, wikis, and more, and I haven''t turned up
examples of how to have multiple entities in a single-table inheritance
related to anything.
I have an addresses table, but multiple entities can have Addresses:
both Person (which has 2 addresses) and Retailer. I''ve been told that I
need to use single-table inheritance, and this was my attempt:
2006 Apr 08
2
one-to-one relationship confusion
Hello,
I posted a similar email, earlier in the week, but I still must not be
getting it.
I have a customer that aggregates two addresses; a shipping address
and a billing address. Addresses can also be referenced by other
objects in a similar way, so I would really like to avoid putting the
keys referencing the customer or other objects in the addresses table.
Addresses are exclusively
2006 Mar 24
0
A "virtual model" that encapsulates other models?
...ta together
from tables used by other models?
For instance, let''s say I have a model of a "customer" which has_many
"addresses", of which one of the "addresses" is the default address.
So what I''d like to do is to actually have a model, say
"Shipping_Addresses" that pulls "First name" and "Last name" out from
"customer" and sticks it to the rest of the address details as pulled
from "addresses".
Is this doable?
--
Posted via http://www.ruby-forum.com/.
2005 Sep 29
0
Table relationships with single table inheritance
Hi,
How do I relate a table to another when one of the models uses single table
inheritance? Will this even work? This is the specific problem I am having:
There''s an "Address" model with "ShippingAddress" and "BillingAddress" as
subclasses. It looks like this:
class Address < ActiveRecord::Base
End
class ShippingAddress < Address
has_one :order
2006 Jul 21
3
How can I create OrderItems that go in a Order?
I suspect my problem is similar to having an order and wanting to have
order items as part of the order, so I''ll explain the problem in those
more familiar terms and then explain what if anything makes my actual
situation different at the end.
In an Order lets say you have: shipping_address and a shipped bool.
OrderItem has quantity and name
So Order has_many :OrderItems, and OrderItem
2006 May 04
22
Should controllers be "smart"?
I''m working on a small project with a friend, and one of the things we
needed to do was send off an email whenever someone signs up an
account. His implementation was pretty simple - throw a
deliver_welcome call inside the controller after the signup. I''m sure
that this is a pretty common thing to do.
The problem, in my mind, was that the app now became tied to two
places -