Commit Graph

68 Commits

Author SHA1 Message Date
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
4c20825457 applies new string literal convention in activemodel/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:38:23 +02:00
Jon Moss
b351061b83
Remove unused require and unused model stub
- The `Project` model should have been removed in 468939297db91f8e595a93c94a16e23b26eee61a.
- The superfluous require was added in 605c6455ac722ed9679e17458a47cc649cdedab0.

Closes #25215

Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-05-31 11:30:23 -07:00
Zachary Scott
f7ebdb1ac5 Remove XML Serialization from core.
This includes the following classes:

- ActiveModel::Serializers::Xml
- ActiveRecord::Serialization::XmlSerializer
2015-08-07 11:01:48 -04:00
Rafael Mendonça França
7919c29d50 Merge pull request #16381 from kakipo/validate-length-tokenizer
Allow symbol as values for `tokenizer` of `LengthValidator`
2015-02-13 12:09:36 -02:00
Akira Matsuda
b23365fe5c Move model definition to test/models for test order indenendency 2014-08-28 16:56:53 +09:00
kakipo
c3fa5c3d25 Allow symbol as values for tokenize of LengthValidator 2014-08-03 14:50:09 +09:00
Rafael Mendonça França
74c31ac5fe Merge pull request #15959 from aditya-kapoor/remove-unneeded-cases
remove unneeded test model for ActiveModel test cases.
2014-07-29 18:08:07 -03:00
Aditya Kapoor
7b1a42c057 automatically include ActiveModel::Validations when include ActiveModel::SecurePassword 2014-07-03 02:51:12 +05:30
Aditya Kapoor
94b6207910 remove unneeded test model for ActiveModel test cases. 2014-06-28 22:27:06 +05:30
Eric Hutzelman
088c11658a Fix some validators when used on model instance
Now that Validator #setup is called from the initializer, we need a
reference to the model's class to be passed in to allow the validators
to continue functioning when used at the instance level.

Closes #14134.
2014-02-26 21:35:49 -03:00
Godfrey Chan
b6ddbfb158 Removed old tests 2014-01-24 19:49:31 -08:00
Godfrey Chan
19a4ef305d Rewrote the tests for has_secure_password 2014-01-24 19:49:30 -08:00
Akira Matsuda
a3ebe7f3a7 Unused classes in AMo tests 2013-12-19 18:31:11 +09:00
Akira Matsuda
68db6bc431 Let validates_inclusion_of accept Time and DateTime ranges
fixes 4.0.0 regression introduced in 0317b93c17a46d7663a8c36edc26ad0ba3d75f85
2013-10-23 22:10:15 +09:00
Patrick Robertson
eebb9ddf9b Convert ActiveModel to 1.9 hash syntax.
I also attempted to fix other styleguide violations such as
{ a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
2013-05-01 18:01:46 -07:00
Yves Senn
bc19c0d09c test for ActiveModel::Conversion#to_partial_path and namespaced models 2013-01-14 21:17:22 +01:00
Rafael Mendonça França
ccecab3ba9 Remove observers and sweepers
They was extracted from a plugin.

See https://github.com/rails/rails-observers

[Rafael Mendonça França + Steve Klabnik]
2012-11-28 22:46:49 -02:00
Francesco Rodriguez
df2b60cd41 fix failing isolated tests 2012-10-26 23:03:36 -05:00
Francesco Rodriguez
070329596f AM::Serializers::Xml depends on AM::Naming 2012-10-26 21:45:40 -05:00
Guillermo Iguaran
9bfa13bb06 attr_accessible and attr_protected raise an exception pointing to use plugin or new protection model 2012-09-16 23:58:21 -05:00
Guillermo Iguaran
f8c9a4d3e8 Remove MassAssignmentSecurity from ActiveModel
This will be moved out to protected_attributes gem
2012-09-16 23:58:19 -05:00
Guillermo Iguaran
a8f6d5c645 Integrate ActiveModel::ForbiddenAttributesProtection from StrongParameters gem 2012-09-16 23:58:19 -05:00
Robby Grossman
ad7f9cdf00 has_secure_password should not raise a 'digest missing' error if the calling class has specified for validations to be skipped. 2012-07-31 16:16:21 -04:00
Erich Menge
f021377358 Updated tests for has_secure_password. 2012-05-08 18:08:55 -05:00
José Valim
fd86a1b6b0 Rely on a public contract between railties instead of accessing railtie methods directly. 2011-11-23 19:06:45 +00:00
Grant Hutchins & Peter Jaros
bf812074fd Let ActiveModel instances define partial paths.
Deprecate ActiveModel::Name#partial_path. Now you
should call #to_path directly on ActiveModel
instances.
2011-07-25 16:05:24 -04:00
Alexander Uvarov
528f405cdc Allow to specify mass-assignment roles as array 2011-06-23 12:56:39 +06:00
Joshua Wehner
2cef2d411a Methods that return nil should not be considered YAML 2011-05-10 12:06:09 -04:00
Myron Marston
1f8cc446d9 Allow observers to be enabled and disabled.
This is useful in situations like model unit tests and the occasional rake task to backfill old data.
2011-04-28 10:23:49 +08:00
Josh Kalderimis
1054ebd613 AM mass assignment security attr_accessible and attr_protected now allow for scopes using :as => scope eg.
attr_accessible :name
    attr_accessible :name, :admin, :as => :admin
2011-04-24 09:53:18 +02:00
Santiago Pastorino
a00bed0c48 Revert "Properly interpolate i18n keys in modules [#5572 state:resolved]"
This breaks #6448, you should use :"module/class" as key for namespacing
[#6448 state:committed]

This reverts commit 8d30193b08bd2321a7a78a1f481bd5e4d4d45557.
2011-02-27 21:30:03 -02:00
Santiago Pastorino
acf0688fdd failing test for i18n key collision with namespaced models 2011-02-27 21:23:52 -02:00
Tsutomu Kuroda
ad31549ab3 Override attributes_protected_by_default when has_secure_password is called.
attr_protected should not be called, because it nullifies the
mass assignment protection that has been set by attr_accessible.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-09 18:35:15 -02:00
Carl Lerche
cd13fbd8d8 Optionally pass in the attribute being validated to an instance method validator 2011-02-05 16:44:35 -08:00
Carl Lerche
e9e9ed6b60 Be able to pass a validator method to #validates 2011-02-05 16:33:00 -08:00
Carl Lerche
ed7614aa7d Provide a way to specify alternate option keys for validates 2011-02-05 16:00:57 -08:00
David Heinemeier Hansson
bcf4e4f2b0 Added ActiveRecord::Base#has_secure_password (via ActiveModel::SecurePassword) to encapsulate dead-simple password usage with SHA2 encryption and salting 2010-12-18 13:38:05 -08:00
José Valim
232e56ce87 No need to pass self as parameter here. 2010-10-04 22:32:29 +02:00
Ernie Miller
21cb1d40b9 Test to_model being called in ActiveModel::Naming helpers
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-04 21:26:42 +02:00
Rodrigo Rosenfeld Rosas
8d30193b08 Properly interpolate i18n keys in modules [#5572 state:resolved] 2010-09-24 20:41:12 +02:00
Obie Fernandez
275f922a23 Better shortcut options for custom validators [#5672 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 12:49:16 +02:00
Piotr Sarnacki
6e5aed057f Prepared ActiveModel::Naming to handle cases for namespaced isolated engines 2010-09-03 22:59:15 +02:00
Neeraj Singh
2ffa50f5a9 after_validation should be called irrespective of the result of validation.
I confirmed that this is the behavior on 2.3.x .

[5419 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-20 11:24:43 -03:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
José Valim
53310614d7 Reuse already existing classes for ActiveModel tests. 2010-07-21 13:00:56 +02:00
Josh Kalderimis
4b66aab00f mass_assignment_security moved from AR to AMo, and minor test cleanup
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-08 18:28:45 +02:00
Josh Kalderimis
9131a88bb8 validation macros can now be used within an instance 2010-05-13 13:57:37 -07:00
Josh Kalderimis
88ad3ed8b5 removed an old unused model in the AMo tests which also removes another AR dependency 2010-05-09 00:08:11 +03:00
Josh Kalderimis
66913a76af removed use of AR in AMo tests and removed testing of scopes (:on) in individual validation tests and moved them to their own test file 2010-05-08 23:51:36 +03:00