Commit graph

134 commits

Author SHA1 Message Date
Andy Allan
45487e1ff8 Merge branch 'pull/3472' 2022-03-02 15:00:25 +00:00
Tom Hughes
b5f06e06c1 Fix rubocop Rails/TimeZone warnings 2022-03-01 22:55:10 +00:00
Andy Allan
8938ab7997 Remove redundant presence validation on belongs_to
There's no need for us to have it when rails does this for us.
2022-03-01 10:01:16 +00:00
Tom Hughes
03fdc6d67f Add inverse_of to relationships that can't detect it automatically 2022-02-23 19:23:51 +00:00
mmd-osm
2efd73c672 Introduce relation member limit
Adds a new parameter `max_number_of_relation_members` in settings.yml
2022-02-02 13:15:40 +01:00
Tom Hughes
fea1b5b88d Fix new rubocop warnings 2021-12-28 19:47:51 +00:00
Andy Allan
baea8dc10e Remove unused to_xml and to_xml_node methods from models 2021-09-15 17:05:50 +01:00
Tom Hughes
2d50a84004 Fix new rubocop warnings 2021-02-16 21:14:54 +00:00
Tom Hughes
582402ba8f Prefer keyword arguments when method has optional boolean arguments 2020-11-13 10:22:55 +00:00
Tom Hughes
0e2a66e8de Fix new rubocop warnings 2020-08-06 18:42:16 +01:00
Andy Allan
a41d500b9f Create an ApplicationRecord for models to inherit from
This is the default for Rails 5+, and also paves the way for
multiple database support.
2019-11-27 11:50:48 +01:00
Andy Allan
bc850d1d37 Move Relation.to_xml and to_xml_node out of the model and into tests 2019-11-20 15:45:28 +01:00
Tom Hughes
135ec35a91 Fix numericality validation to use correct integer only constraint
Fixes #2355
2019-08-22 12:14:06 +01:00
Andy Allan
4377e2bd55 Update annotations to correctly show bigint types 2019-05-29 11:52:20 +02:00
Tom Hughes
9f57f60b87 Fix new rubocop warnings 2019-04-23 09:33:34 +01:00
Simon Poole
07ffb4c3f6 Calculate bounding box when deleting relations
Closes #2030
Fixes #2020
2018-10-21 19:32:12 +01:00
Xuyang Jia
d0e45c7c8e Fix any_relations always being false
Closes #1976
2018-09-22 17:46:00 +01:00
Tom Hughes
de29e9b3f5 Fix Style/NumericPredicate rubocop warnings 2018-09-22 17:34:58 +01:00
Tom Hughes
64146b4f36 Fix Style/SafeNavigation rubocop warnings 2018-09-22 17:21:06 +01:00
Tom Hughes
6c2093b29d Fix new rubocop warnings 2018-09-22 17:12:29 +01:00
Tom Hughes
a83030dab7 Fix new rubocop warnings 2018-01-22 18:55:45 +00:00
Andy Allan
15b104f4ff Merge branch 'p' of https://github.com/jfirebaugh/openstreetmap-website into jfirebaugh-p
Refs #139
2017-11-22 10:47:18 +00:00
Andy Allan
b2a8df0bd7 Add annotate gem and associated rake task. Annotate models. 2017-10-22 22:18:26 +01:00
Tom Hughes
8dae890a76 Fix rubocop warnings 2017-10-05 19:18:38 +01:00
Tom Hughes
9b89d4eefe Remove conditions from delete_all
Passing conditions directory to delete_all is deprecated
in rails 5.0 so use a separate where instead.
2017-06-02 16:33:48 +01:00
Tom Hughes
5b33f3f8e3 Fix rubocop warnings 2017-06-02 00:08:30 +01:00
Tom Hughes
e5834016fd Clone objects before saving in case of a retry
If a deadlock occurs then the transaction will be retried so we
need to make sure that the object will still be dirty so that it
will be saved again during the retry but that the version won't
be incremented a second time.
2016-11-28 20:31:04 +00:00
Tom Hughes
282ff4936c Fix rubocop warnings 2016-10-31 21:24:10 +00:00
Andy Allan
f464e2a6e9 Suppress XML parsing errors.
This technique was already used in app/models/changeset.rb

This suppresses the error messages when parsing invalid XML, but
the exceptions are still raised, as tested in test_from_xml_double_lat
in test/models/node_test.rb
2016-10-26 10:35:03 +01:00
Tom Hughes
d82f9d12ce Fix new rubocop warnings 2016-09-15 19:21:00 +01:00
Tom Hughes
5d3ecffa28 Fix new rubocop warnings 2016-02-05 13:35:26 +00:00
Tom Hughes
8fe1899596 Fix rubocop warnings 2016-01-19 09:51:24 +00:00
Matt Amos
cf6a5c17ee Fix bug allowing created elements to reference deleted ones
The bug allows a newly-created element to refer to a deleted one
if the transactions for both overlap. Precisely, the issue is that
the check that an element exists does not prevent a concurrent
transaction from altering that row.

Because "deleting" an element in the OSM database does not remove
the row, we cannot rely on FK constraints to ensure the correct
behaviour. Instead, this fix relies on manually locking referenced
elements.

Note that this "fix" is suboptimal, as it does not allow any
updates to the referenced elements. Updates which do not delete
the row could safely be done, but will be prevented.

Also, it's not clear what the negative performance impact of this
change will be.
2015-06-13 10:59:57 +01:00
Tom Hughes
2af0840ff3 Fix style issues found by new rubocop version 2015-04-14 09:38:24 +01:00
Tom Hughes
dfc85f089a Test changeset and note comment notification emails 2015-03-02 00:43:07 +00:00
Tom Hughes
f04211b172 Improve test coverage 2015-02-27 00:40:37 +00:00
Tom Hughes
dbe165bbb3 Fix some rubocop rails style issues 2015-02-26 00:12:54 +00:00
Tom Hughes
a6b84a0294 Fix more rubocop style issues 2015-02-24 23:12:02 +00:00
Tom Hughes
dc2a2c8ebd Standardise on double quoted strings 2015-02-20 19:47:26 +00:00
Tom Hughes
5cbd4038ed Fix rubocop style issues 2015-02-20 08:56:16 +00:00
Tom Hughes
baf10cd392 Fix rubocop lint issues 2015-02-20 08:56:16 +00:00
Tom Hughes
ef7f3d800c Fix most auto-correctable rubocop issues 2015-02-20 08:56:16 +00:00
Tom Hughes
34e3e51456 Cleanup trailing whitespace 2015-02-20 08:56:16 +00:00
Tom Hughes
28b8863627 Remove unused (and non-functioning) code 2014-02-26 18:53:25 +00:00
Tom Hughes
8c029f8d79 Simplify a number of object model methods 2013-12-05 00:50:04 +00:00
Tom Hughes
9544ab12b8 More refactoring of common code in object models
Tidy up code and extract generation of tag elements to the
common code in the ObjectMetadata module.
2013-12-04 00:29:48 +00:00
Simon Legner
413baecf6b Refactor generation of object metadata in API calls
Factor out duplicate from the object models into common code.
2013-12-04 00:09:52 +00:00
Tom Hughes
ca30b879f6 Eliminate deprecated scope and association arguments 2013-09-21 11:35:46 +01:00
John Firebaugh
ee6e0d5c0b Remove unused parameter 2012-11-25 15:14:47 -04:00
John Firebaugh
3d1df30f65 Remove non-functional code 2012-11-25 15:10:53 -04:00