José Valim
9fbb2c571b
Fix error_messages_for when instance variable names are given.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-21 11:18:36 -05:00
José Valim
e714b499cc
Move validator, human_name and human_attribute_name to ActiveModel, remove deprecated error messages and add i18n_scope and lookup_ancestors.
...
Signed-off-by: Carl Lerche <carllerche@mac.com>
2009-10-20 17:52:32 -07:00
Joshua Peek
21e7b84621
Callbacks, DeprecatedCallbacks = NewCallbacks, Callbacks
2009-10-12 22:15:43 -05:00
Joshua Peek
ff56f3d5e1
Rewrite ActiveModel::Lint as a simple TU mixin
2009-10-07 09:24:51 -05:00
Sam Pohlenz
4df96338ed
Fixed behavior of attribute_methods_generated? [ #3220 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-07 09:07:39 -05:00
Sam Pohlenz
f8e91bda9c
Don't share attribute matchers between classes [ #3216 state:resolved]
...
Allows separate models that include ActiveModel::AttributeMethods to
use different sets of attribute matchers.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-07 09:07:39 -05:00
Jeremy Kemper
38e056ee2a
Use ActiveModel::TestCase base class
2009-09-24 22:56:30 -07:00
lakshan
e2d0b0ee61
fixed ActiveModel::Lint typos [ #3236 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-21 09:49:43 -05:00
Brian Donovan
f183288050
Fix typo.
...
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-09-17 18:30:28 -07:00
Jeremy Kemper
8682d76cc9
Revert "Allow frameworks to be required by their gem name"
...
This has just been confusing. Better to educate than band-aid.
This reverts commit 18a24274ec823ded4ffa29bf33fd3d76816aab7e.
Originally from http://dev.rubyonrails.org/ticket/8845 [drnic]
2009-09-12 02:41:01 -07:00
Akira Matsuda
0990a13500
Ensure validation errors to be ordered in declared order
...
[#2301 state:committed milestone:2.3.5]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-11 18:52:22 -07:00
José Valim
2ea1d684d9
Refactor new callbacks and AR implementation.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-08 10:26:39 -05:00
José Valim
4f37b97033
Changed ActiveRecord to use new callbacks and speed up observers by only notifying events that are actually being consumed.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-08 10:26:39 -05:00
Joshua Peek
6dc9ad80e6
Fix warnings in AMo
2009-09-05 19:10:21 -05:00
Joshua Peek
723a47bfb3
Kill AMo observing wrap_with_notifications since ARes was only using it
2009-09-02 11:44:36 -05:00
Joshua Peek
66d713fc8f
License, version, and gemspec for ActiveModel. Ship it!
2009-08-31 19:09:16 -05:00
Kane
cf9f361699
added proc and symbol support to validates_numericality_of [ #3049 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-31 13:35:14 -05:00
Josh Sharpe
80989437dc
I added this feature so that a Map of changed fields could be retrieved
...
after a model had been saved. This is useful in the after_save callback
when you need to know what fields changed. At present there is no way
to do this other than have code in the before_save callback that takes
a copy of the changes Map, which I thought was a bit messy.
Example.
person = Person.find_by_name('bob')
person.name = 'robert'
person.changes # => {'name' => ['bob, 'robert']}
person.save
person.changes # => {}
person.previous_changes # => {'name' => ['bob, 'robert']}
person.reload
person.previous_changes # => {}
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-31 12:50:27 -05:00
Yehuda Katz
dbf20c2dbb
Initial AMo Lint implementation
2009-08-29 01:49:18 -05:00
Joshua Peek
c6bc8e6626
Break up concerns for choosing what attributes should be serialized and the actual serializer
2009-08-13 22:27:36 -05:00
Joshua Peek
f97dae5ebe
Extract common dirty tracking methods in AMo
2009-08-10 13:51:48 -05:00
Joshua Peek
391f978acd
AMo overrides alias_attribute and manages aliasing all known attribute method matchers
2009-08-10 11:58:44 -05:00
Joshua Peek
d574cb31f0
Centralize attr method name concatenation in AttributeMethodMatch
2009-08-10 11:53:10 -05:00
Pratik Naik
e202c6c814
Move :with/:without check outside the method generated by validates_format_of
2009-08-10 15:24:48 +01:00
Elliot Winkler
cccb0e6b93
Add validates_format_of :without => /regexp/ option [Elliot Winkler, Peer Allan]
...
[#430 state:resolved]
Example :
validates_format_of :subdomain, :without => /www|admin|mail/
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 15:22:31 +01:00
Jeff Dean
22f3398253
Introduce validates_with to encapsulate attribute validations in a class.
...
[#2630 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:47:56 -07:00
Adam Keys
5632b36701
Fix exclusive range patch to use begin/end instead of min/max. [ #2981 status:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-08 23:42:18 +01:00
Pratik Naik
c6fe49b009
Simplyfy validates_length_of and remove puts
2009-08-08 19:08:39 +01:00
jzw
5ab94b2595
validates_length_of with maximum should allow nil [ #2309 status:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-08 19:08:13 +01:00
Pratik Naik
5ce3831faf
Use send instead of instance_eval
2009-08-06 00:11:28 +01:00
James Hill
cfd421daa2
Allow validations to use values from custom readers [ #2936 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-05 11:45:01 -05:00
Joshua Peek
f8d3c72c39
Extract generic attribute method generation to AMo
2009-08-04 23:36:05 -05:00
Joshua Peek
aad5a30bf2
Add simple support for ActiveModel's StateMachine for ActiveRecord
2009-08-04 11:03:57 -05:00
Yehuda Katz
c4d1075bd3
Add support for error_messages_for(@obj)
2009-07-28 19:06:14 -07:00
Joshua Peek
272c504f91
Dasherize XML root by default to avoid invalid tags "<admin/posts>...</admin/posts>" [ #2875 state:resolved]
2009-07-22 21:06:34 -05:00
John Maxwell
c39151a847
Patch to ActiveModel's (and ActiveRecord, by association) XML serialization: If two parameters are present in Procs supplied to to_xml's :procs option, the model being serialized will be passed as the second argument [ #2373 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-07-22 20:47:15 -05:00
Joshua Peek
574323df62
So you can require 'activemodel'
2009-07-21 00:52:50 -05:00
Joshua Peek
92c00d7586
AMo conversion helper
2009-07-21 00:51:57 -05:00
Joshua Peek
6944b391cd
Kill AMo Base
2009-07-21 00:13:26 -05:00
Joshua Peek
48bc39e03a
Improve AMo observing docs
2009-07-21 00:11:26 -05:00
Joshua Peek
7c84bbf160
Add wrap_with_notifications helper to AMo observing
2009-07-20 23:57:01 -05:00
Joshua Peek
2685d93b07
Kill AMo ivar attributes helper
2009-07-20 23:28:58 -05:00
Yehuda Katz
5ffaaa71d1
Define ActiveModel API Compliance
...
- Define to_model on AR
- Define to_model on ActiveModel::APICompliant
- Update test fixtures to be API Compliant
- Start using to_model in AP
2009-07-20 00:27:04 +09:00
Yehuda Katz
1a2946a6d9
Add some missing dependencies
2009-07-15 14:16:30 -07:00
Joshua Peek
e83a05af07
Integrate AMo XML serializer into AR
2009-07-11 16:20:58 -05:00
Joshua Peek
783db25e0c
Integrate AMo JSON serializer into AR
2009-07-03 23:12:42 -05:00
Joshua Peek
d2b78b3594
Initial extraction of AMo xml serializer
2009-07-03 21:38:14 -05:00
Joshua Peek
e3d6d10e1f
Ensure JSON serializer includes model naming
2009-07-03 21:38:13 -05:00
Joshua Peek
fbdf706fff
Add basic JSON serializer to AMo
2009-06-17 21:27:54 -05:00
Joshua Peek
af5301089f
Add simple attribute implementation backed by ivars
2009-06-17 21:27:54 -05:00