user646560
user646560

Reputation:

Rails 3: Nested Attribute presence validation?

I have 3 Deeply nested attraibutes:

Process has many categories, Categories has many Blocks

How do i place validate_presence_of calls so when a user is creating a new process and attempts to create a category within it without a definition lets say, that he is redirected to the process edit form and told definition can not be left empty empty?

DO i place the validation in process model or category model?

Thanks

Upvotes: 0

Views: 884

Answers (1)

Bert Goethals
Bert Goethals

Reputation: 7887

Validations always go on to the model they are validating. Rails will handle the nesting.

Upvotes: 2

Related Questions