Displaying 2 results from an estimated 2 matches for "customer_order_numb".
Did you mean:
customer_order_number
2010 Apr 14
1
Rails does not display form error message on a custom method
...order method)
when things go wrong but it doesn''t specify the details like a normal
form would. The error messages should appear if the customer order
number is not unique for that client.
Below is the custom method (checkout) related code.
Order Model:
[code]
validates_uniqueness_of :customer_order_number, :scope => :client_id
[/code]
Orders_controller:
[code]
def checkout
@order = current_order
end
def complete_order
@order = current_order
respond_to do |format|
if @order.update_attributes(params[:order])
@order.complete #sets submitted datetime and state t...
2010 Apr 14
1
Rails validations app specific problems
...want to
validate certain things, like if my customer''s order number is present
(validates_presence_of). This should be easy, but since the order has
ALREADY been created I need to validate the presence of an attribute.
Also, I can''t just do this:
[code]
validates_presence_of :customer_order_number, :on => :update
[/code]
Because it generates a validation error on my ''/cart'' page which is
where I can go and edit the product quantities for the client order.
**I''m sure the solution lies in validates_presence_of with the :if
condition, but I just can''t...