aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
Commit message (Collapse)AuthorAgeFilesLines
* expose a few attribute changed methodsAaron Patterson2013-06-111-10/+10
|
* remove some evals from callback conditionalsAaron Patterson2013-06-112-2/+7
|
* fix ActiveModel::Validations.validators_on docDaichi Arai2013-06-101-1/+0
|
* Docfix: Use public interface instead of setting instance variablesRichard Livsey2013-06-071-1/+1
| | | Dynamically setting instance variables based on user input probably isn't a great idea. Better to go through the setter methods provided by attr_accessor.
* Fix regression in has_secure_password.Phil Calvin2013-05-301-4/+3
| | | | If the confirmation was blank, but the password wasn't, it would still save.
* deprecate Validator#setup (to get rid of a respond_to call). validators do ↵Nick Sutterer2013-05-234-12/+35
| | | | their setup in their constructor now.
* deprecating string based terminatorsAaron Patterson2013-05-142-2/+5
|
* respond_to -> respond to in a message from AM::LintXavier Noria2013-05-121-1/+1
| | | | | | | | The error message uses English to say that the object should respond to a certain method. You check that with respond_to, but that's not English. This makes this error message also consistent with the rest.
* Using define method instead of class eval when defining model callbacks.wangjohn2013-05-081-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on my benchmark results, this change improves performance substantially when defining callbacks. This benchmark (https://gist.github.com/wangjohn/5542610) was run using the current master and also using my experimental branch which replaced class_eval with define_single_method. Using class_eval (current master): user system total real 10 trials 0.000000 0.000000 0.000000 ( 0.001568) 50 trials 0.020000 0.000000 0.020000 ( 0.021715) 500 trials 0.110000 0.000000 0.110000 ( 0.115357) 1000 trials 0.250000 0.000000 0.250000 ( 0.260025) 10000 trials 2.560000 0.000000 2.560000 ( 2.568408) 50000 trials 12.800000 0.010000 12.810000 ( 12.886871) Using define_single_method (experimental branch): user system total real 10 trials 0.000000 0.000000 0.000000 ( 0.000790) 50 trials 0.000000 0.000000 0.000000 ( 0.002960) 500 trials 0.050000 0.010000 0.060000 ( 0.055690) 1000 trials 0.100000 0.000000 0.100000 ( 0.094073) 10000 trials 0.890000 0.000000 0.890000 ( 0.900364) 50000 trials 4.650000 0.000000 4.650000 ( 4.686127)
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-0118-40/+40
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* rails/master is now 4.1.0.betaRafael Mendonça França2013-04-291-1/+1
|
* Bump version to rc1David Heinemeier Hansson2013-04-291-1/+1
|
* pass over the code commentsXavier Noria2013-04-281-28/+32
| | | | | | * Highlights the requirement of an attributes method. * Removes some details that depend on the implementation of the class including the module. * Applies guidelines here and there.
* Prefer find_by over dynamic finders in rdocSam Ruby2013-04-022-8/+8
|
* Improve changelog entry for ActiveModel::Errors#full_messages_for [ci skip]Carlos Antonio da Silva2013-03-301-2/+0
| | | | Add a working example of how to use this new method.
* Add a method full_messages_for to the Errors classshock_one2013-03-241-0/+14
|
* Merge pull request #8501 from charliesome/version-to-sRafael Mendonça França2013-03-231-6/+7
|\ | | | | Add #to_s method to VERSION modules
| * Add version method to top level modulesCharlie Somerville2013-03-211-6/+7
| |
* | Remove exception variable from rescue blockCarlos Antonio da Silva2013-03-221-2/+2
| | | | | | | | | | Just raising from the rescue block will re-raise the exception, so the variable is not necessary.
* | Change Standard error when is required bcrypt-ruby and failsrobertomiranda2013-03-211-2/+7
| |
* | Tidying up some require : removing useless sort and homogenizing with the ↵Intrepidd2013-03-201-4/+1
|/ | | | rest of the code the wat the includes are done
* The repair_validations helper was not working correctly before becausewangjohn2013-03-191-0/+43
| | | | | | it only cleared the validations that created :validate callbacks. This didn't include the validates created by validates_with, so I've added a method to clear all validations.
* Merge pull request #9545 from senny/9535_secure_password_blankRafael Mendonça França2013-03-072-3/+13
|\ | | | | `has_secure_password` is not invalid when assigning empty Strings
| * `has_secure_password` is not invalid when assigning empty Strings.Yves Senn2013-03-041-2/+8
| | | | | | | | | | | | | | | | | | | | Closes #9535. With 692b3b6 the `password=` setter does no longer set blank passwords. This triggered validation errors when assigning empty Strings to `password` and `password_confirmation`. This patch only sets the confirmation if it is not `blank?`.
| * `validates_confirmation_of` does not override writer methods.Yves Senn2013-03-041-1/+5
| |
* | Small TypoLebin Sebastian F2013-03-041-1/+1
|/
* Preparing for 4.0.0.beta1 releaseDavid Heinemeier Hansson2013-02-251-1/+1
|
* Clarify ActiveModel::Validator initialization in docs.Henrik Nyh2013-02-091-0/+3
| | | As discussed with @josevalim on Ruby Rogues Parley.
* Missing require extract_optionsAkira Matsuda2013-01-311-0/+2
|
* Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by"Guillermo Iguaran2013-01-182-3/+3
| | | | | This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1.
* User Rails 4 find_byrobertomiranda2013-01-182-3/+3
|
* Set default value to ActiveModel::Validator initializer attributeIrio Irineu Musskopf Junior2013-01-091-1/+1
| | | | Makes it easier to test its objects.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-01-091-1/+1
|\ | | | | | | | | Conflicts: guides/source/getting_started.md
| * prefer american spelling of 'behavior'Gosha Arinich2013-01-071-1/+1
| |
* | 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