Commit Graph

31 Commits

Author SHA1 Message Date
Adam Meehan
4523138c3c Add Rails initializer to set Timeliness.ambiguous_date_format for Timeliness v0.4+ 2019-08-03 12:38:39 +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
13fcc32a83 Test model had wrong validation method 2017-05-14 20:12:36 +10: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
0444bdc650 Datetime select extension fixes with help from @johncarney's fork 2015-12-29 15:49:18 +11:00
Adam Meehan
08b16f155c Rspec 3 syntax 2015-12-29 14:55:03 +11:00
Jarl Friis
0d2c7ce554 Fix for running tests in non-Australian timezones 2013-04-30 19:56:19 +02:00
Adam Meehan
7bcdea1738 RSpec config cleanup 2012-07-13 21:43:29 +10:00
Adam Meehan
3f4615e053 scope a spec to AR version 2012-02-01 21:25:05 +11:00
Adam Meehan
5be45b00db Hook into undefine_attributes_methods to remove timeliness methods as well 2012-02-01 20:38:05 +11:00
Adam Meehan
86b7bc4829 Fix before_type_cast for non-dirty attributes (issue #52).
Only use before_type_cast implementation if earlier than 3.1.0 which has
it's own working version for date/time fields now.
2011-09-21 21:28:53 +10:00
Adam Meehan
af9d6cdba4 Fix brokena and brittle tests 2011-09-18 18:33:30 +10:00
Adam Meehan
1faf0efa4b Spec helper validate method setup in test models not needed 2011-09-18 18:33:29 +10:00
Adam Meehan
3793ef2ed4 fix for validation nil value with :format option plugin parser disabled (issue 34) 2011-01-29 16:07:56 +11:00
Adam Meehan
983e80f239 move some files into spec/support and include ModelHelpers in config 2011-01-28 19:36:02 +11:00
José Valim
889b5a9b07 Move timeliness defined methods to a module so they can be overwritten. 2010-11-01 14:56:03 -02:00
Adam Meehan
6e67d45274 Validation support for ActiveModel::Validations without a shim
move validation helpers into ActiveModel::Validations for default base support
add check if attribute methods shim is being used
refactor specs for helper and attribute methods separation
more mongoid workarounds due to incorrect use of AS::Concern
2010-09-29 08:09:43 +10:00
Adam Meehan
f41903a769 refactored to get attribute type from model types not validation type
reverts to behaviour of old version which allows you to define validations
of any type for sake of the values it is validating against
2010-09-24 12:00:15 +10:00
Adam Meehan
896427a8d5 rspec updates 2010-09-21 10:22:48 +10:00
Adam Meehan
27e01486e9 actually use the plugin parser in the write method (yikes) 2010-09-21 08:36:11 +10:00
Adam Meehan
5d495505d9 proper timezone awareness and plugin parser hooks
Parser uses method compilation technique namely to a method not a proc
2010-09-16 22:35:38 +10:00
Adam Meehan
9ddd150b2f change ORM attribute generation and extension mechanism
now using shim since the attribute matcher is not required for AM
2010-09-16 22:33:22 +10:00
Adam Meehan
924c6766c1 renamed to enable_multiparameter_extension! 2010-08-03 23:27:46 +10:00
Adam Meehan
0f41671b32 multiparameter extension for AR 2010-08-03 22:59:29 +10:00
Adam Meehan
048bf3ba6c generate local file on install rather than load 2010-08-03 18:27:35 +10:00
Adam Meehan
7117a5ef22 reset employee class in specs 2010-08-03 15:06:51 +10:00
Adam Meehan
34a2d4b558 methods for validated attributes for write cache and before type cast
cache raw value in @attributes_cache which is AR convention but should
work fine with non-AR ORM
before type cast method for reading back cached raw value
2010-08-03 15:01:57 +10:00
Adam Meehan
fabb2be7af date/time select extension 2010-08-02 16:58:03 +10:00
Adam Meehan
d5124f32b2 use setup block to config which classes to extend 2010-08-01 23:27:25 +10:00
Adam Meehan
fdc3086976 initial Rails 3 rewrite commit
completely rewritten for ActiveModel compatibility
uses ActiveModel EachValidator class as validator base class
simplifies :between by splitting into a :on_or_before and an :on_of_after
only :is_at option tested
2010-08-01 18:35:18 +10:00