On Mar 21, 2006, at 17:11, Bryan Corey wrote:
> Hello there,
>
> I have a "user" object essentially that contains address
information
> that gets stored in the database. The user can sign up and go through
> the whole page before he needs to enter that information which is
> associated with a billing process. Without having to write some odd
> validation based on the request_uri and passing it to a custom
> validation method is there any way I can make the
> validates_presence_of
> only occur on the one billing action, and no where else such as
> account
> creation or account updates? Thanks ahead of time.
Just off the top of my head looks like a user does not require a
billing address, and your model correctly reflects that.
The billing address is a model in its own and it is required for the
*bill*. So I''d move that validates_presence_of to the Bill model. On
the other hand the billing address belongs_to a user that has_one
billing address. Then, it is the billing address who
validates_presence_of :user. That matches your current flow.
Just some quick feedback that may be nonsense in the real application.
-- fxn