Commit Graph

334 Commits

Author SHA1 Message Date
Naoto Takai
80a2c9e5db Improve logging of ActiveModel::MassAssignmentSecurity::Sanitizer 2012-05-17 06:55:41 +09:00
Carlos Antonio da Silva
9b4f5041d2 Kill whitespaces ✂️ 2012-05-15 13:38:29 -03:00
Carlos Antonio da Silva
3d1b078a5b Merge pull request #6284 from acapilleri/dup_validation
clean the erros if an object that includes validation  is duped.
2012-05-15 05:20:57 -07:00
Francesco Rodriguez
00c94d7d94 updating define_attribute_methods documentation 2012-05-14 11:38:23 -05:00
Francesco Rodriguez
05234b358f allow define_attribute_methods to pass multiple values 2012-05-14 11:35:15 -05:00
Angelo Capilleri
f9ae1baa0a clean the erros if an object that includes validations errors is duped. Fixes #5953 2012-05-13 23:24:05 +02:00
Santiago Pastorino
36dd1857dc Remove useless load path modifications 2012-05-11 19:00:35 -03:00
Jon Leighton
a8637cf493 Use respond_to?(:to_ary) rather than is_a?(Enumerable) to detect collection-thing. 2012-05-11 20:11:04 +01:00
Marc-Andre Lafortune
dc74f0cb1b notify_observers should be public 2012-04-30 22:13:26 -04:00
Aaron Patterson
206b43a954 Merge pull request #6063 from marcandre/observer_extra_args
Allow extra arguments for Observers
2012-04-30 16:43:22 -07:00
Marc-Andre Lafortune
24c068d67d Allow extra arguments for Observers 2012-04-30 18:10:03 -04:00
Arun Agrawal
7f248076a3 build fix for observing_test.rb
introduced here 17c990b153f8635874c006a7460ee95817543fc1
2012-04-30 15:27:18 +05:30
Santiago Pastorino
4cff1a2809 Merge pull request #6072 from marcandre/observer_simplify_test
Observer: simplify tests
2012-04-30 00:15:51 -07:00
Jeremy Kemper
0393c7cd51 Merge pull request #6071 from marcandre/observer_redef
Fix Observer by acting on singleton class. Fixes #3505.
2012-04-29 21:10:15 -07:00
Marc-Andre Lafortune
17c990b153 Observer: simplify tests 2012-04-29 22:02:02 -04:00
Marc-Andre Lafortune
bad44e4f8f Fix Observer by acting on singleton class [#3505]
Also [issue #1034] [pull #6068]
2012-04-29 21:51:50 -04:00
Aaron Patterson
f975a8663e Merge pull request #5942 from bcardarella/confirmation_error_message_on_confirmation_attribute
confirmation validation error attribute
2012-04-29 16:29:33 -07:00
Marc-Andre Lafortune
569fb1fffb Generate appropriate error more judiciously 2012-04-29 00:51:56 -04:00
Carlos Antonio da Silva
cafe6a38f5 Do not modify options hash in human_attribute_name, remove reverse_merge 2012-04-28 11:23:29 -03:00
José Valim
cd556c9388 Merge pull request #5841 from oscardelben/rename_count_observers
Rename Observing#count_observers to Observing#observers_count
2012-04-24 23:09:48 -07:00
Oscar Del Ben
692b3b6b6a Fix secure_password setter 2012-04-24 19:16:01 +02:00
Brian Cardarella
4433b1a99a Support i18n attributes for confirmation 2012-04-24 01:05:41 -04:00
Brian Cardarella
fcc534ed76 confirmation validation error attribute
This will render the error message on :#{attribute}_confirmation instead
of on attribute itself. When rendering confirmation errors inline on the
form with form builders such as SimpleForm and Formtastic it is
confusing to the ender user to see the confirmation error message on the
attribute element. Instead it makes more sense to have this validation
error render on the confirmation field instead.

The i18n message has been updated for the confirmation validator error
message to include the original attribute name.
2012-04-23 17:16:05 -04:00
Oscar Del Ben
27d6ccd8c8 Rename Observing#count_observers to Observing#observers_count 2012-04-14 10:48:53 +02:00
Aaron Patterson
6289f455ae test against ruby features in order to fix tests on Ruby 2.0 2012-03-26 11:32:21 -07:00
José Valim
35e8de6344 Merge pull request #5374 from nertzy/remove_deprecated_partial_path_from_active_model_naming
Remove ActiveModel::Naming#partial_path
2012-03-23 05:57:35 -07:00
José Valim
eb8f0ddb67 Revert "AM::MassAssingmentSecurity: improve performance"
It introduces backwards incompatible changes in the API.

This reverts commit 7d1379ffdbbaf01e99833dc06611b7e4f3799522.
2012-03-15 18:41:54 +01:00
Bogdan Gusiev
7d1379ffdb AM::MassAssingmentSecurity: improve performance 2012-03-14 14:11:52 +02:00
Grant Hutchins
bf8d7574bf Remove ActiveModel::Naming#partial_path
It was deprecated in 3.2
2012-03-10 18:02:36 -05:00
Grant Hutchins
e78c5eeba1 Fix comments about to_partial_path 2012-03-10 17:40:27 -05:00
Carlos Antonio da Silva
10c3304db6 Make sure serializable hash with :include always returns string keys 2012-03-09 21:51:12 -03:00
Carlos Antonio da Silva
cb9d03f0d4 Add docs with usage examples for ActiveModel::Model
Also add test to ensure basic model does not explode when
initialized with nil.
2012-03-03 04:45:30 -03:00
Guillermo Iguaran
3b822e91d1 Add ActiveModel::Model, a mixin to make Ruby objects to work with AP inmediatly 2012-03-02 23:59:55 -05:00
Bogdan Gusiev
534dc4ca1a AM::Errors: allow :full_messages parameter for #as_json 2012-02-20 11:17:11 +02:00
Fabio Yamate
d204918f91 Fix sanitize_for_mass_assigment when role is nil
There is an example in Rails documentation that suggests implementing
assign_attributes method for ActiveModel interface, that by default
sends option role with nil. Since mass_assignment_authorizer never
is called without args, we can move the default value internally.
2012-02-15 11:13:54 -02:00
Carlos Antonio da Silva
ad9f968c4a Make sure serializable hash with :methods option returns always string keys 2012-02-13 11:22:59 -02:00
Carlos Antonio da Silva
5bcb4e3c18 Cleanup extra spaces 2012-02-13 11:20:19 -02:00
prasath
848ee296ec test title changed corresponding to the test 2012-02-09 02:11:36 +05:30
Aaron Patterson
06b9c905a9 Merge pull request #4930 from ask4prasath/ordered_hash_replaced
Replacing ordered hash to ruby hash on active model
2012-02-08 08:59:00 -08:00
José Valim
a17d047a73 Trim down Active Model API by removing valid? and errors.full_messages 2012-02-07 23:10:43 +01:00
prasath
47628ec128 replacing ordered hash to ruby hash 2012-02-08 00:34:47 +05:30
Niels Ganser
60dad828ae To infinity… and beyond!
Allow infinite values for validates_length_of. Particularly useful
for prettily defining an open ended range such as

validates_length_of :human_stupidity, :within => 0..Float::INFINITY
2012-02-06 12:58:32 +01:00
Carlos Antonio da Silva
26861e9506 Generate strict validation error messages with attribute name 2012-02-01 11:34:17 -02:00
prasath
f4d9ba0296 Removed unwanted intializer and replaced with ruby default collect method 2012-01-27 00:13:46 +05:30
prasath
bf31d7b224 Removing unwanted method and adding to accessor for getter history 2012-01-25 01:34:04 +05:30
dreamfall
e84998cc21 validates method should not change options argument 2012-01-17 13:18:58 +03:00
Paweł Kondzior
5313eab695 Fix ActiveModel::Errors#dup
Since ActiveModel::Errors instance keeps all error messages as hash
we should duplicate this object as well.

Previously ActiveModel::Errors was a subclass of ActiveSupport::OrderedHash,
which results in different behavior on `dup`, this may result in regression for
people relying on it.
2012-01-16 23:22:51 -08:00
Piotr Sarnacki
8e8982cf3b Add ActiveModel::Errors#delete, which was not available after move to use delegation 2012-01-16 17:23:40 +01:00
Carlos Antonio da Silva
e5df4f9255 Fix test class name that should read Without 2012-01-16 00:00:57 +01:00
Piotr Sarnacki
b164e81c11 Fix stack level too deep when model does not have attributes method.
Without that patch when using ActiveModel::AttributeMethods
in a class that does not respond to `attributes` method,
stack level too deep error will be raised on non existing
method. While documentation is clear that you need to define
`attributes` method in order to use AttributeMethods module,
`stack level too deep` is rather obscure and hard to debug,
therefore we should try to not break `method_missing` if
someone forgets about defining `attributes`.
2012-01-15 15:54:59 +01:00