Commit Graph

211 Commits

Author SHA1 Message Date
Adam Meehan
a836ed8434 changed Formats#parse to take options hash for strict and other possibilities 2009-03-28 17:35:41 +11:00
Adam Meehan
312c1510cb refactored AR parsing methods into Parser module to reduce AR method pollution and make more consistent 2009-03-28 17:25:48 +11:00
Adam Meehan
728c5ccda5 safely extract time values from multiparam array 2009-03-26 15:20:08 +11:00
Adam Meehan
4f0c81b6f8 properly chain multiparameter attributes 2009-03-26 15:13:35 +11:00
Adam Meehan
d1ee94248b added :equal_to and :ignore_usec options. the later is for ignore microsecond value in datetime restrictions 2009-03-19 20:49:06 +11:00
Adam Meehan
fae38cfecd use value as raw_value if object doesn't have _before_type_cast method 2009-03-12 19:08:31 +11:00
Adam Meehan
903850bc23 Merge branch 'with' for with_date and with_time options 2009-03-10 15:51:07 +11:00
Adam Meehan
c3f3edf324 added enable method for multiparameter attribute handling of datetime which is enabled by default but will be off in version2
renamed enable action view extension method and enable both extensions in the one method as they are needed together
2009-03-08 17:55:48 +11:00
Adam Meehan
1dbac5190b fix last refactor so it casts Date object to time if attribute is datetime or time with spec added 2009-03-05 19:56:38 +11:00
Adam Meehan
497a97e0b0 cleanup setup and version check guff. enable action view extension by default until version 2 2009-03-05 18:34:16 +11:00
Adam Meehan
9dd3282a81 add method to enable action view invalid value extension. will be on by default but will off in version 2 2009-03-05 18:32:25 +11:00
Adam Meehan
e7e9a8b238 fix bad variable name 2009-03-05 18:30:48 +11:00
Adam Meehan
cb962d1157 some refactoring and behave even more friendly with alias_method_chain 2009-03-05 18:10:59 +11:00
Adam Meehan
403a91addf added if and unless to valid options 2009-03-04 21:09:51 +11:00
Adam Meehan
7ca84f3116 behaves as better AR citizen by alias_method_chaining define_attribute_methods and read_attribute instead of overriding 2009-03-03 12:38:54 +11:00
Adam Meehan
862b41f903 added :with_date and :with_time options
refactored restriction_value into evaluate_option_value class method for more general usage
refactored type_cast_value into class method
2009-02-09 16:44:03 +11:00
Adam Meehan
904c202fb4 little cleanup and consistency 2009-02-09 12:11:56 +11:00
Adam Meehan
1001d29c01 rails 2.3.0 fix with I18n.reload!
added 2.3 to ginger list
2009-02-08 20:54:45 +11:00
Adam Meehan
29c23a7a26 move format compilcation call to where it belongs 2009-02-08 13:02:06 +11:00
Adam Meehan
7ef9078369 use the value from validates_each in validator 2009-02-08 12:46:22 +11:00
Adam Meehan
a1ae5f9313 added option key validation to prevent silly validation problems due to bad key name 2009-02-01 20:08:07 +11:00
Adam Meehan
71583805c8 fixed regex for yy format token which wasn't greedy enough when datetime string parsed as date causing a 4 digit year to be extracted as first 2 digits 2009-01-21 14:07:35 +11:00
Adam Meehan
2ee971623c whitespace 2009-01-21 14:07:20 +11:00
Adam Meehan
817e49940c removed the 'resume' call, um wtf? 2009-01-21 14:05:46 +11:00
Adam Meehan
575ff85346 Merge branch 'months' 2009-01-13 20:07:54 +11:00
Adam Meehan
65ed8a657e format months names now respect i18n 2009-01-13 20:05:55 +11:00
Adam Meehan
0ad8ace335 refactored AR attribute methods to define read method for all date, time and datetime attributes. Makes things much clearer and fixes bug reported (#2) by Brad (pvjg) 2009-01-13 10:12:41 +11:00
Adam Meehan
7c9ec695f4 small refactor and cleanup of formats class 2009-01-12 21:42:14 +11:00
Adam Meehan
9f1642c730 fix matcher error_message_for when i18n is loaded and custom error message to use regular string interpolation 2009-01-12 13:04:41 +11:00
Adam Meehan
011ea070db fix interpolation_values examples for rails version without i18n 2009-01-12 13:03:21 +11:00
Adam Meehan
525b3b9941 fix custom_error_message hash bug using wrong match data index 2009-01-12 12:35:35 +11:00
Adam Meehan
1fdfc23cb8 fixed bug in matcher using local variable for options, must not have run the specs one last time before last release. Umm marr 2009-01-03 19:07:27 +11:00
Adam Meehan
694a4bdd69 change error to warning for untested Rails version 2009-01-01 20:53:19 +11:00
Adam Meehan
a71d6f7945 added between option testing to matcher and refactored 2009-01-01 20:13:44 +11:00
Adam Meehan
45ab815039 added between option and some refactoring 2009-01-01 20:11:30 +11:00
Adam Meehan
5abaec66ae remove version check, check for I what I want 2008-12-09 16:56:03 +11:00
Adam Meehan
40437c970d make format error raise with message 2008-12-07 21:29:50 +11:00
Adam Meehan
e9fa4ca20a fixed bug where accessor methods not properly generating due columns_hash lookup failing on method name as a symbol
force value to time on write unless is a date attribute
2008-12-07 11:07:39 +11:00
Adam Meehan
e4760126e2 allow for a string column being validated as a date/time 2008-12-07 11:06:43 +11:00
Adam Meehan
75f3ef34e8 made parameters explicit for validates_timeliness since its private and should not be used directly for validation 2008-12-05 20:35:37 +11:00
Adam Meehan
4cb51ae602 teeny comment correction 2008-12-05 20:30:54 +11:00
Adam Meehan
87b0beef5a moved ignore_restriction_errors and error_value_formats into Validator class 2008-12-05 20:24:06 +11:00
Adam Meehan
6cd6cd9dc0 made restriction_value instance method as it relies on validator instance attribute type
removed old type_cast_method class method
2008-12-05 18:45:28 +11:00
Adam Meehan
0c5cc1a536 more refactoring of validator
fixed bug when Date is restriction value for a datetime attribute so its cast to time in default timezone
2008-12-05 18:25:44 +11:00
Adam Meehan
bf999170d7 fix timezone issue for to_dummy_time as per normal Rails which uses AR default_timezone 2008-12-05 16:34:28 +11:00
Adam Meehan
dbfd9231b5 moved including of modules into module files 2008-12-03 21:44:39 +11:00
Adam Meehan
3da24f0f33 a few changes to prepare for better version support 2008-12-03 21:22:19 +11:00
Adam Meehan
6f4306973b updated some comments 2008-12-03 21:20:53 +11:00
Adam Meehan
71f2a43424 added i18n support for error messages in Rails 2.2 2008-12-03 18:20:34 +11:00
Adam Meehan
c386a9cdcf removed some naff comments 2008-12-02 21:40:41 +11:00
Adam Meehan
1596ffd2cb namespaced matcher 2008-12-02 21:07:08 +11:00
Adam Meehan
d847d3b95a removed a debug hint in matcher 2008-12-02 20:42:00 +11:00
Adam Meehan
3ac65b507f renamed methods which have been moved out of AR and so dont need to be fully qualified 2008-12-02 20:34:02 +11:00
Adam Meehan
d71f581e10 refactored error message handling and specs 2008-12-02 19:36:03 +11:00
Adam Meehan
aa42fb76b6 get the model to add errors to record returned from validation instead of validator 2008-11-30 08:34:17 +11:00
Adam Meehan
b0647d456e refactored validations in validation methods for model and validator class 2008-11-30 07:40:11 +11:00
Adam Meehan
412ff22dd9 namespaced ActiveRecord and ActionView specifc modules and specs with a mind to making the plugin framework agnostic in the future 2008-11-29 18:32:32 +11:00
Adam Meehan
705e787775 small cleanup and correction of docs 2008-11-23 17:42:34 +11:00
Adam Meehan
a54d562a69 refactored version checks for method aliasing 2008-11-23 17:41:58 +11:00
Adam Meehan
889bdc3ae3 allow uppercase meridian to be valid 2008-11-13 10:26:16 +11:00
Adam Meehan
604a792e25 Rails 2.2 compatibility fixes with more version check hackery (yuck, will fix later) 2008-10-28 22:05:25 +11:00
Adam Meehan
ced61929da fixed dirty attributes when old value incorrectly read and added more examples for dirty attributes 2008-10-28 19:54:52 +11:00
Adam Meehan
8f950d5ac6 refactored attribute write method definitions in single definition and added write_date_time_attribute method to unify value writing 2008-09-24 15:58:08 +10:00
Adam Meehan
f23d2a0c2d fixed non-timezone write method not updating changed attributes hash 2008-08-25 14:30:36 +10:00
Adam Meehan
0ef34c7d28 parse_date_time method returns for date column to return Date object when assigned string as per normal Rails
parse_date_time method returns same object when assigned Date or Time object
2008-08-22 15:12:38 +10:00
Adam Meehan
b9f11a1f7b fixed bug with attribute cache not clearing on write for date and time columns 2008-08-22 14:06:08 +10:00
Adam Meehan
d61249d6f5 fixed instance_tag value method when attribute value is nil and improved specs 2008-08-14 11:44:18 +10:00
Adam Meehan
9a76d06309 parse using timeliness_restriction_value method on matcher option values to allow all possible value types 2008-08-07 12:24:17 +10:00
Adam Meehan
097e2c58ba refactored matcher a little and cleaned up a little 2008-08-03 14:29:54 +10:00
Adam Meehan
dff45bc6ec refactored restriction validation conversion_method case statement into restriction_type_cast_method method 2008-08-03 14:28:02 +10:00
Adam Meehan
a666c35ccd moved restriction value evaluation into own method with recursive calls for Symbol and Proc in case they return string 2008-08-03 12:53:59 +10:00
Adam Meehan
8cad1b880e remove setting attribute to nil in validations when invalid to preserve before_type_cast value 2008-07-30 12:22:06 +10:00
Adam Meehan
ef51d8c3d6 refacrtored option tests into test_option_method 2008-07-26 08:31:36 +10:00
Adam Meehan
29d61320e8 prettied up failure messages by formatting values 2008-07-26 08:12:25 +10:00
Adam Meehan
7fd251dddf added rest of specs for matcher 2008-07-26 07:49:26 +10:00
Adam Meehan
79460dc39b added specs for matcher and fixed up bugs 2008-07-26 00:16:17 +10:00
Adam Meehan
ed165d3f9d minor doc changes 2008-07-25 22:30:24 +10:00
Adam Meehan
555748fac9 minor doc tweak 2008-07-25 21:52:18 +10:00
Adam Meehan
32621ceebe added restriction value error message formats as global accessor for customisation
added each invalid type to error messages rather than shortcut way
2008-07-25 19:21:30 +10:00
Adam Meehan
5567f920f7 standardising test values 2008-07-24 18:55:20 +10:00
Adam Meehan
69ac9e678d using date and time string convert methods from validates_date_time plugin which handles different array lengths 2008-07-23 20:39:25 +10:00
Adam Meehan
776e3008d2 added extra check to see if time zone attributes in enabled 2008-07-23 12:43:42 +10:00
Adam Meehan
5c03d3d645 added define_write_method with simple parse and cace for dates, times and datetimes when time zone conversion is off and default for Rails 2.0 2008-07-23 12:42:03 +10:00
Adam Meehan
7500781887 added compile_set method to get expressions and combine date and datetime expressions to allow a date string to parse when type is datetime
made internal methods private
2008-07-23 12:39:20 +10:00
Adam Meehan
85ac2bfc69 changed method to check type and compose string for specific type to properly validate
refactored specs
2008-07-23 12:35:42 +10:00
Adam Meehan
2be6c639d6 changed 2008 to 2000 in effort to standard test date values 2008-07-22 18:57:45 +10:00
Adam Meehan
5885290304 added back Rails 2.1 check for time zone conversion attribute in define_attributes_methods and check for Rails 2.0 to return true if Time class column 2008-07-22 12:59:37 +10:00
Adam Meehan
28b44b4ca6 some docs tweaks and spec value changes 2008-07-22 11:47:17 +10:00
Adam Meehan
727f3dc8e3 added make_time method to do time object creation with correct timezone handling for Rails 2.1 and 2.0 2008-07-22 11:45:33 +10:00
Adam Meehan
a674089c00 return Date object for date type timeliness_date_time_parse method 2008-07-22 10:13:52 +10:00
Adam Meehan
800b187d08 added Date class define write method convert with parser
removed strict_time_type_cast method and use parse method directly
2008-07-22 10:11:27 +10:00
Adam Meehan
89f12b3a25 renamed extract method to parse and updated specs 2008-07-22 08:34:14 +10:00
Adam Meehan
3c9ad4a5ee added microseconds adjustment method and added proc_args 2008-07-21 16:50:08 +10:00
Adam Meehan
5e08a10fb0 renamed calls to timeliness_date_time_parse to parse_date_time which will correctly an overrided method 2008-07-21 13:48:25 +10:00
Adam Meehan
539f823b8b removed usless whitespace check in non-strict regexp match 2008-07-21 13:47:19 +10:00
Adam Meehan
4e8007bc65 added ignore_datetime_restriction_errors class option and docs
bit more for chronic parser
2008-07-21 13:02:21 +10:00
Adam Meehan
1836e4f6ca removed setting of time parts to 0 for date type in parse as any time parts should be valid as well
format proc now returns time array with nil values as 0
2008-07-21 10:31:06 +10:00
Adam Meehan
7a16d35e31 tweaked readme
changed mixed validation spec to datetime value out of Time range
2008-07-20 10:53:09 +10:00
Adam Meehan
9cf994564e fixed fallback for out of range dates which Rails does not handle automatically
aliased timeliness_date_time_parse to parse_date_time for nicer interface
2008-07-20 09:06:39 +10:00
Adam Meehan
70ba75a4ae added switching to euro date formats instead of US 2008-07-20 08:38:34 +10:00