[openstreetmap/openstreetmap-website] Added a validation to the Redaction model for the title. (#2034)

Andy Allan notifications at github.com
Wed Oct 24 06:53:01 UTC 2018


@RoyallDesigns Thanks for your PR. If we decide to make the redaction title required, then there are three things that should be changed:

* The database needs to have a "not null" constraint added on the `title` column. This will require a [migration](https://edgeguides.rubyonrails.org/active_record_migrations.html) to be added. The migration might also need to check for existing records with blank titles, and set a default title, before adding the constraint.
* The model needs to have a validation, which is what you've got here
* The model test (in test/models/redaction_test.rb) should have a new test, asserting that the redaction is not valid when the title is empty. This ensures that any refactoring mistakes that happen to the model in future get caught in the test suite.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2034#issuecomment-432534816
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20181023/57ebf779/attachment.html>


More information about the rails-dev mailing list