条件を指定して検索しています。すべての条件を解除する
2024/4/18 -Conditional validations allow you to apply validation rules based on certain conditions being met. Sometimes it is useful to have multiple validations using one ...
2024/4/16 -Rails 7.1 added a validation option for enum, so it's now straightforward to validate that the value of an enum attribute is an allowed value and, ...
2024/5/8 -The validate_foreign_key method is used to validate the foreign key constraint on a table. In other words, it checks that the value in the foreign key column of ...
2024/5/10 -1. Validations. You can validate that start_time cannot be in the past with the comparison validator (added in Rails 7): validates :start_time, comparison: ...
22時間前 -So I learned about validations that occur at the model-level, but I'm now trying to learn more about database validations. I was wondering if you guys could ...
2024/6/3 -Let's see how to validate an association in Rails. Let's look at the example below. # app/models/work/delivery.rb class Work:: ...
Q.Ruby on Railsのvalidatesの使い方について。 同ユーザーの同回答を防ぐためにvalidatesのuniqunessを使用していますが、これだと他のユーザーにも制限がかかってし...
A.回答を一意にするUserなのかどうかを判別するフラグを新たに持たせて、それをwith_optionsメソッドで判定すればいいです。 以下を参考にしてください。 Railsで特定の条件下で走る...
Q.Ruby On Rails のバリデーションに関する質問です。 validates を、メソッド内ではなく、クラスの直下で定義していますが、validates はプロパティなのでしょうか? それ...
A.validates は ActiveModel::Validations モジュールで 定義されてる特異メソッドで ActiveRecord::Base などの フィールドをチェックします。 今...
Q.個人でRubyでwebアプリを開発しています。 セキュリティについて不安があります。 そのwebアプリは動画販売サービスです。 クレジットカードはトークンを使用して支払いなどをするので安全だと...
A.データベースより前に、フロントエンドの脆弱性対策が先だと思います。 まずは、無料のツールを使ってみてはいかがですか。 https://yun-craft.com/admin-blog/tomiz...
2024/5/6 -※氏名は一般的に10文字で収まりません。実際に制限をつける場合は、255文字までにするなど、制限を緩くしましょう。
2024/6/4 -Validation rules that can differ for new or existing objects. class Account < ActiveRecord::Base validates :subdomain, :name, ...
2024/5/18 -単体テストコードでエラーと超格闘してます。そこでバリデーションを任意で設定する方法について、わかったのでアウトプットします。
2024/5/17 -This results in a validation error, causing some nested associations to not be saved (without error), causing null values in the insert query, causing a SQL ...