1日前 -The Numericality Validator should not accept 'abc' as valid number, even when the attribute was normalized. Actual behavior. Given the normalizer. normalizes : ...
3日前 -I've got a child model that has an end_date attribute and a validation which ensures only one record can leave this attribute blank (this is also enforced ...
3日前 -I've got a child model that has an end_date attribute and a validation which ensures only one record can leave this attribute blank (this is also enforced ...
4日前 -Common validations include `presence` (`validates :name, presence: true`), `length` (`validates :password, length: { minimum: 6 }`), and `numericality` (` ...
3日前 -How do you handle validations in Rails? Validations are added to models using methods like validates. For example: class User < ApplicationRecord.
1日前 -Is it a best practise to repeat the database constraints in model validation in Rails? DB level vs App level? or both? Best Practice: Use BOTH. Why both ...
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...
2日前 -Join the GoRails community forum to discuss Ruby on Rails, get help, share tips, and connect with fellow developers.
5日前 -This Ruby style guide recommends best practices so that real-world Ruby programmers can write code that can be maintained by other real-world Ruby programmers.
3日前 -Constraint validation is done through the Constraint Validation API either on a single form element or at the form level, on the <form> element itself.
5日前 -最後に validates メソッドでどのようにバリデーターを読み込んでいるのか紹介します。 validates メソッドは ActiveModel::Validations::ClassMethods に定義されています ...