Displaying 1 result from an estimated 1 matches for "add_api_error".
2012 Mar 11
1
notifications (or flash messages) in an api application
...notifications and @api_errors. Now, the problem would be the validation of the user action, and here might be several messages to send:
- Stock finished
- No money
- No access to this feature ...
- CC invalid
... etc
now ... i can do my checks like
if false == money_requirement?
self.add_api_error "You do not have enough money"
end
if false == product.stock_requirement?
self.add_api_error ....
end
But the main problem ... would be now, the method of trigger the action.
if self.api_errors.size == 0
# do play with the user account, stocks and other stuff ....
end
what i...