aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
Commit message (Collapse)AuthorAgeFilesLines
* Reduce number of Strings a bitAkira Matsuda2013-01-072-3/+3
|
* Namespace HashWithIndifferentAccessAkira Matsuda2013-01-071-1/+1
|
* Updated copyright notices for 2013Andrew Nesbitt2012-12-311-1/+1
|
* Revert the change at ActiveModel::Errors#add_on_blank and fix in theRafael Mendonça França2012-12-262-9/+3
| | | | | | | | | | | right place. The EachValidator#validate already handle :allow_blank and :allow_nil, correctly. Closes #8622. Fix #8621.
* Tests and fix for validates_presence of :allow_nil, :allow_blankColin Kelley2012-12-261-1/+7
| | | | | Conflicts: activemodel/lib/active_model/errors.rb
* chmod -x from non-script filesAkira Matsuda2012-12-241-0/+0
|
* Use :present as key for the absence validatior messageRafael Mendonça França2012-12-212-2/+2
|
* Remove ActiveModel::Errors#add_on_present method.Rafael Mendonça França2012-12-213-16/+3
| | | | | | | | We don't need to define a new method in ActiveMode::Errors for each validatior. See https://github.com/rails/rails/commit/d72a07f1d1478db9daed847eadb35bfd840674f6#commitcomment-2325333
* Add `ActiveModel::Validations::AbsenceValidator`, a validator to check the ↵Roberto Vasquez Angel2012-12-153-0/+45
| | | | | | absence of attributes. Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
* Merge pull request #8510 from thedarkone/thread_safety_improvementsAaron Patterson2012-12-141-4/+5
|\ | | | | Thread safety improvements
| * Replace some global Hash usages with the new thread safe cache.thedarkone2012-12-141-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of the changes: * Add thread_safe gem. * Use thread safe cache for digestor caching. * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation. * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache. * Use TS::Cache to avoid the synchronisation overhead on listener retrieval. * Replace synchronisation with TS::Cache usage. * Use a preallocated array for performance/memory reasons. * Update the controllers cache to the new AS::Dependencies::ClassCache API. The original @controllers cache no longer makes much sense after @tenderlove's changes in 7b6bfe84f3 and f345e2380c. * Use TS::Cache in the connection pool to avoid locking overhead. * Use TS::Cache in ConnectionHandler.
* | Only call `in_time_zone` on Time or DateTime instancesAndrew White2012-12-111-1/+6
|/ | | | | Both String and Date now respond to in_time_zone so we need to check if the value is a Time or a DateTime.
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-043-6/+6
| | | | | | | | | | Sometimes, on Mac OS X, programmers accidentally press Option+Space rather than just Space and don’t see the difference. The problem is that Option+Space writes a non-breaking space (0XA0) rather than a normal space (0x20). This commit removes all the non-breaking spaces inadvertently introduced in the comments of the code.
* Reset attributes should not report changes.Renato Mascarenhas2012-12-011-1/+4
| | | | | | | | | | | When resetting an attribute, you expect it to return to the state it was before any changes. Namely, this fixes this unexpected behavior: ~~~ruby model.name = "Bob" model.reset_name! model.name_changed? #=> true ~~~
* Remove observers and sweepersRafael Mendonça França2012-11-283-527/+0
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* Specify type of singular association during serializationSteve Klabnik2012-11-281-1/+6
| | | | | | | | | | | | When serialising a class, specify the type of any singular associations, if necessary. Rails already correctly specifies the :type of any enumerable association (e.g. a has_many association), but made no attempt to do so for non-enumerables (e.g. a has_one association). We must specify the :type of any STI association. A has_one association to a class which uses single-table inheritance is an example of this type of association. Fixes #7471
* Merge pull request #7282 from xHire/validates_length_of_fixRafael Mendonça França2012-11-261-2/+14
|\ | | | | | | | | | | | | Length validation handles correctly nil. Fix #7180 Conflicts: activemodel/CHANGELOG.md
| * Length validation handles correctly nil. Fix #7180Michal Zima2012-11-261-2/+14
| | | | | | | | When nil or empty string are not allowed, they are not valid.
* | cleanup, removed dispensable `require` statements from `ActiveModel`Yves Senn2012-11-257-12/+0
| |
* | cleanup, remove broken whitespaceYves Senn2012-11-254-9/+9
|/
* Point user to strong_parameters as the new protection model [ci skip]Saulius Grigaliunas2012-11-181-4/+6
|
* Initialize #min_cost to avoid warning in Ruby 2.0Carlos Antonio da Silva2012-11-171-2/+3
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-171-0/+4
|\ | | | | | | | | Conflicts: actionpack/lib/action_dispatch/routing/redirection.rb
| * add details on password confirmation used with has_secure_passwordDaniel Lopes2012-11-131-0/+4
| |
* | Use BCrypt's MIN_COST in the test environment for speedier testsTrevor Turk2012-11-142-1/+8
| |
* | Trivial documentation fix for ActiveModel::Naming comment.Dennis Taylor2012-11-091-2/+2
| |
* | rm dead codeAaron Patterson2012-11-091-1/+1
| |
* | use Array() instead flattenVasiliy Ermolovich2012-11-051-2/+2
| | | | | | | | | | * move ActiveModel::Errors tests to errors_test.rb * add spec coverage for add_on_empty and add_on_blank
* | Raise ArgumentError when no attribute is given to AMo::EachValidatorCarlos Antonio da Silva2012-11-041-1/+1
| | | | | | | | ArgumentError is better suited than RuntimeError for this.
* | Set hash value instead of using merge!Carlos Antonio da Silva2012-11-041-1/+1
|/
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-0312-43/+35
|\ | | | | | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/mime_responds.rb activerecord/lib/active_record/attribute_methods.rb guides/source/working_with_javascript_in_rails.md
| * minor edits and remove mixed titles in AM::Validations docs [ci skip]Francesco Rodriguez2012-10-259-21/+13
| |
| * fix output messages - docs [ci skip]Francesco Rodriguez2012-10-221-16/+16
| |
| * convert comments to 1.9 hash syntaxAvnerCohen2012-10-223-17/+17
| |
* | Make caller attribute in deprecation methods optionalAlexey Gaziev2012-10-302-2/+2
| |
* | Provide a call stack for deprecation warnings where needed.Nikita Afanasenko2012-10-292-7/+6
| | | | | | | | It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
* | fix AM::Serializers titles [ci skip]Francesco Rodriguez2012-10-262-2/+2
| |
* | AM::Serializers::Xml depends on AM::NamingFrancesco Rodriguez2012-10-261-0/+4
|/
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-10-2123-35/+35
|\ | | | | | | | | | | Conflicts: activesupport/lib/active_support/core_ext/hash/slice.rb guides/source/active_support_core_extensions.md
| * minor edits in AM documentation [ci skip]Francesco Rodriguez2012-10-2122-32/+32
| |
| * remove non-breaking spaces [ci skip]Francesco Rodriguez2012-10-181-3/+3
| |
* | active_model/validations requires necessary files to runYves Senn2012-10-181-0/+1
| |
* | cleanup, replace non-breaking spaces with spacesYves Senn2012-10-181-5/+5
|/
* Use the `flat_map` method.Rafael Mendonça França2012-10-031-2/+2
| | | | Thanks to @jeremy to teach me this one.
* Revert "Merge pull request #7826 from sikachu/master-validators-kind"Rafael Mendonça França2012-10-021-14/+1
| | | | | | | | | | | | | | | | This reverts commit 4e9f53f9736544f070e75e516c71137b7eb49a7a, reversing changes made to 6b802cdb4f5b84e1bf49aaeb0e994b3be6028af9. Revert "Don't use tap in this case." This reverts commit 454d820bf0a18fe1db4c55b0145197d70fef1f82. Reason: Is not a good idea to add options to this method since we can do the same thing using method composition. Person.validators_on(:name).select { |v| v.kind == :presence } Also it avoids to change the method again to add more options.
* Don't use tap in this case.Rafael Mendonça França2012-10-021-5/+7
| | | | | The use of tap in this case is very confusing since we are mutating the return value inside the block
* Make `.validators_on` accept `:kind` optionPrem Sichanugrist2012-10-021-1/+12
| | | | | This will filter out the validators on a particular attribute based on its kind.
* Switch to using include? on validation callbacksJohn Foley2012-09-231-2/+2
|
* Fix collisions with before and after validation callbacks.John Foley2012-09-231-2/+6
| | | | | | This commit allows a user to do something like: before_validation :do_stuff, :on => [ :create, :update ] after_validation :do_more, :on => [ :create, :update ]
* add :nodoc: to AMo::DeprecatedMassAssignmentSecurity::ClassMethods [ci skip]Francesco Rodriguez2012-09-201-3/+3
|