Ruby on Rails: errors.add_to_base vs. errors.add

前端 未结 3 2060
失恋的感觉
失恋的感觉 2021-01-31 02:00

I have read that errors.add_to_base should be used for errors associated with the object and not a specific attribute. I am having trouble conceptualizing what this means. Cou

3条回答
  •  别跟我提以往
    2021-01-31 02:49

    A missing genre would be a field error. A base error would be something like an exact duplicate of an existing record, where the problem wasn't tied to any specific field but rather to the record as a whole (or at lest to some combination of fields).

提交回复
热议问题