フォームのバリデーションをJavaScriptでやりたい場合、どんなAPI設計にするのが良いか? 例 ユーザーのバリデーションが下記のように定義されているとする。 class User < ApplicationRecord validates :user_name, presence: true, uniqueness: true, format: { with: /\w/ } validates :age, numericality: { only_integer: true, greater_than_or_equal_to: 0 } end このバリデーションをどうにかJavaScript側からも使いたいけど、こういう場合はバリデーション用のAPIを毎回作る感じですかね? module Validations class UsersController < ::Applicatio