Commit Graph

116 Commits

Author SHA1 Message Date
Carl Lerche
bd53ebde72 Add required dependencies on activemodel 2009-09-01 12:26:00 -07:00
Yehuda Katz
67f5d611f5 Add rake gemspec and gemspecs to the repo 2009-08-31 17:20:44 -07: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
Pratik Naik
25e5b0c4a8 Remove support for SQLite 2.
If you're still using it, please install the plugin from git://github.com/rails/sqlite2_adapter.git
2009-08-17 14:54:34 +01: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
108545a9d6 Clean up validation example 2009-07-21 00:56:27 -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
45d41d8012 Add some simple examples for unconventional AMo and AP use 2009-07-19 23:24:19 +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
Yehuda Katz + Carl Lerche
7583a24ee0 Move mocha down below initial T::U require and bump version to 0.9.7 [#2858 state:resolved] 2009-07-01 11:53:17 -07: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
Joshua Peek
d5d59230f4 Simplify AMo validation attribute reader 2009-06-17 21:27:54 -05:00
Joshua Peek
1c4d28ba31 Move model naming into ActiveModel 2009-06-17 10:37:39 -05:00
Joshua Peek
8f7c657f4b Move observing notify helper into AMo 2009-06-11 13:41:48 -05:00
Joshua Peek
c4e440b1d2 Fix observing AS dependencies 2009-06-11 13:21:56 -05:00
Joshua Peek
4d70359200 Integrate ActiveModel::Observing into ActiveRecord 2009-06-10 23:36:44 -05:00
Jeremy Kemper
14de1a9597 each yields per message not per attribute 2009-06-08 19:37:51 -07:00
Joshua Peek
28f36279cd Properly require ActiveModel validation dependencies 2009-06-08 20:32:08 -05:00
Joshua Peek
01515f8ecd Fix activesupport path 2009-06-08 19:59:56 -05:00
Jeremy Kemper
5481e54175 AM::StateMachine autoloads 2009-05-30 11:59:16 -07:00