Commit Graph

195 Commits

Author SHA1 Message Date
Adam Meehan
f8b91e9cea v5.0.0.beta2 2020-07-12 16:26:54 +10:00
Adam Meehan
7fa4d85ee3 Change load_config_initializers to sym in Railtie 2020-07-04 17:07:28 +10:00
Adam Meehan
3134072f01 v5.0.0.beta1 2020-01-06 15:48:51 +11:00
Adam Meehan
3835b2b161 v5.0.0.alpha5 2019-08-08 10:34:27 +10:00
Adam Meehan
46296f914f ensure timeliness initializer is after initializer files 2019-08-03 12:56:08 +10:00
Adam Meehan
4447361743 hash syntax 2019-08-03 12:38:47 +10:00
Adam Meehan
4523138c3c Add Rails initializer to set Timeliness.ambiguous_date_format for Timeliness v0.4+ 2019-08-03 12:38:39 +10:00
kamille-321
3a2882be75 use ActiveSupport on_load hook for extend ActiveRecord 2019-03-09 01:14:08 +09:00
Adam Meehan
7233ff66dd v5.0.0.alpha4 2019-02-09 12:00:31 +11:00
Adam Meehan
f39fbb0ad2 v5.0.0.alpha3
Bump with fixed file permissions only.
2018-07-31 09:07:09 +10:00
Adam Meehan
bc6d4fe5fc v5.0.0.alpha2 2018-07-02 21:12:12 +10:00
Adam Meehan
70335cd0ba Use prepend for Type overrides /ht @jasl closes #179 2018-07-02 21:08:47 +10:00
Adam Meehan
837de0d212 v5.0.0.alpha1 2018-07-02 21:08:47 +10:00
Adam Meehan
093e33fbed Move conversion module methods in Converter class
Encapsulate conversion helper methods
2018-05-19 16:28:35 +10:00
Adam Meehan
e5bb096161 Move method generation to ActiveModel only and use type system in AR
The ActiveModel type system with extensions in ActiveRecord provide
us a lot of convenience. Some general attribute code is now moved to
ActiveModel only as the AR types provide raw value capturing
(before_type_cast) and type classes to handle type specific string
value parsing if enabled.

In my view, we need to go futher and strip out more from ActiveModel
extension but at least we should have compatibility at the moment.
2018-05-19 15:22:23 +10:00
Adam Meehan
402a6b6e3e Change multiparamter extension to use AR type classes
Multiparamter extension used to do a lot of crappy work to ensure that
the invalid Date dates were not accepted, but also to store a
before_type_cast value in cases when it was invalid. We no longer need
to handle the before_type_cast value as ActiveRecord does that nicely.

Now we just ensure values to cast with a invalid date parts is not
accepted.
2018-05-18 08:58:00 +10:00
Adam Meehan
a1f42fce28 Remove old version checks 2018-05-16 13:12:30 +10:00
Adam Meehan
941055c16e Restore usage of DateTime substitute value object
Remove initialize override. Not sure why what was added.
2018-05-16 09:27:27 +10:00
Adam Meehan
4fef42ac24 Rails 5.x compatible Tag value method signature 2018-05-16 09:06:36 +10:00
Adam Meehan
84b1885b6b cannot use POSITION in actionview to map value key 2018-05-15 19:59:59 +10:00
Adam Meehan
90501a8e56 Tag value method takes objects 2018-05-15 19:27:15 +10:00
AquisTech
c9ca900abf Fix issue#166 alias_method_chain not working in Rails 5 2018-05-14 19:52:24 +05:30
Adam Meehan
a88ae0829c MultiparameterAttribute does not exist anymore 2018-05-13 21:46:26 +10:00
Adam Meehan
6cc47d84e8 setting up for rails 5 work 2018-05-13 21:45:06 +10:00
Adam Meehan
43554d8bf0
Merge pull request #152 from aditya-kapoor/allow-generic-msg
Allow the validator to take in the `message` option too.
2018-05-13 20:50:08 +10:00
Adam Meehan
da473b7eea
Update validator.rb
tweak message key lookup
2018-05-13 20:49:25 +10:00
yxf
8a04deebfa Fixed version checking of ActiveModel 2017-05-14 17:07:24 +08:00
Aditya Kapoor
e9c9914c4f Allow the validator to take in the message option too. This is useful in those scenarios where we have a set of generic keys which we need to show.
This would eliminate the need to keeping multiple copies for the default keys set defined by gem.

    The following seems more apt than the later one:

    ```
    validates_date :start_at, on_or_after: :today, message: 'should not be in past'
    ```

    ```
    validates_date :start_at, on_or_after: :today, on_or_after_message: 'should not be in past'
    ```
2017-03-22 13:21:59 +05:30
Adam Meehan
5c1406e9b0 v4.0.2 2016-01-07 08:26:19 +11:00
Adam Meehan
32f92cc885 Set @timeliness_methods_generated = false on undefined 2016-01-07 08:25:09 +11:00
Adam Meehan
cb3ac8d445 v4.0.1 2016-01-06 22:20:44 +11:00
Adam Meehan
4e5f5fa695 Return value if not of known type in type cast 2016-01-06 22:20:24 +11:00
Adam Meehan
321834b5ff Fix thread lock on undefine
Move active model methods into active model ORM module to be included
manually if not using AR or other ORM
2016-01-06 22:18:54 +11:00
Adam Meehan
ff131415f7 Fix shadowing 2016-01-06 16:36:25 +11:00
Adam Meehan
ad43eb31d6 Return date if date type 2016-01-06 16:35:01 +11:00
Adam Meehan
22ab7f4455 v4.0.0 2015-12-29 16:01:57 +11:00
Adam Meehan
2424acc075 Generate default config with AR orm enabled 2015-12-29 15:58:42 +11:00
Adam Meehan
0444bdc650 Datetime select extension fixes with help from @johncarney's fork 2015-12-29 15:49:18 +11:00
Adam Meehan
feb508f171 Validator 4.x compat 2015-12-29 14:57:56 +11:00
Adam Meehan
24f2752c2e Multiparam extension 4.x changes 2015-12-29 14:57:38 +11:00
Adam Meehan
afa8dee6ab Rails 4.x attribute assignment compatability 2015-12-29 14:56:58 +11:00
Adam Meehan
1ddf0f1b0f Remove all mongoid stuff and put in validates_timeliness-mongoid 2015-12-28 14:24:24 +11:00
Adam Meehan
bb830baea2 Rails 4.0 and 4.1 compat for #setup method removal 2015-11-10 17:52:34 +11:00
Julien Vanier
7d37882327 Generate attribute methods once instead of on each object creation
This is a memory and performance improvement change.

The attribute methods for timeliness are generated at each object creation instead of once, at first creation like AR attribute methods. Since creating those methods uses `module_eval` it's quite slow when it's done each `Model.new`.

For more details on the performance improvement, see the same change on John Carney's fork: https://github.com/johncarney/validates_timeliness/pull/6
2015-09-24 14:58:12 -04:00
Adam Meehan
12f6d2a467 Merge pull request #104 from johnnyshields/mongoid-3
Update to Mongoid 3
2015-09-12 17:23:20 +10:00
Obfuscoder
f1b8925a36 Fix typo in comment of initializer template 2014-11-02 20:59:50 +01:00
Johnny Shields
99ae8fe7d7 Update for Mongoid 3:
- Now requires Mongoid 3.0 as minimum version (this is the only version to support Rails 3.2)
- Upgrade specs/helpers for Mongoid 3
- Support Mongoid aliased field names (e.g. field :foo, as: bar, type: String). Includes spec
- Support before_type_cast on Mongoid. No code change was required for this, only a spec change.
- There was one mongoid spec that was previously marked pending. I've found that it now works on Mongoid 3.
- Removed some Mongoid 2.3 and earlier hacks, which simplifies the Mongoid ORM code.
2013-07-24 11:05:01 +09:00
Adam Meehan
3d798697e1 Merge pull request #98 from 907th/master
Range with excluded end passed to :between option should be split into :on_or_after and :before options
2013-04-30 04:45:54 -07:00
Alexey Chernenkov
dc0fdc0340 Range with excluded end passed to :between option should be split into :on_or_after and :before options 2013-04-30 15:37:44 +06:00
Will O'Brien
609fafe7bb Require 'active_model'
Apparently classes are lazily required when using autoload. Prompted by
'uninitialized constant ActiveModel::Validations'
2013-04-25 22:42:28 -04:00