Hi all –
The simple question is: How do I set different validations for the same
Model, when accessed in different Controllers?
Here’s the scenario: I have a store/cart app, with a customer-facing
shopping cart, and a typical Admin side. The Admin side also has an
Order Entry component, where our staff can enter orders received by fax,
telephone, etc. Both the customer-facing cart and the Admin-side Orders
would use the same model (same underlying data) for customer information
- billing, shipping, etc.
However, the Admin side is intended to be a bit more flexible than the
customer-facing side. For example, we might take international orders by
phone, but not over the Web. Or we might allow payment with
PO/check/cash by an Admin-side order, but not from a Web order.
If I set something like “validate :credit_card_number” in the Model, it
will trigger on the Admin side, requiring a credit card, where I’d
prefer to allow a blank credit card. How do I set per-Controller
validation? Or, is there another, more idiomatic way to approach this