Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

子モデルのバリデーションエラーをcascadeするバリデータを追加する #81

Merged
merged 1 commit into from
Aug 18, 2024

Conversation

kakeru-one
Copy link
Contributor

@kakeru-one kakeru-one commented Aug 18, 2024

対応するissue

対応内容

  • 子モデルのバリデーションエラーをcascadeするバリデータを追加した。
    • 以下のように使用できます。以下の例だと、MemoモデルとMemoTagモデルのvalid?がfalseになった時にバリデーションエラーがBuildFormのerrorsに格納されます。
class Memo
  class BuildForm
    validates :memo, cascade: true
    validates :memo_tags, cascade: true
  end
end

@kakeru-one kakeru-one self-assigned this Aug 18, 2024
@kakeru-one kakeru-one added the backend バックエンドのissues label Aug 18, 2024
@kakeru-one kakeru-one force-pushed the enhance/#80-add_cascade_validator branch from 71bd401 to 63f4f5b Compare August 18, 2024 14:38
@kakeru-one kakeru-one merged commit 12a290a into main Aug 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend バックエンドのissues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

子モデルのバリデーションエラーをcascadeするバリデータを追加する
1 participant