Abd ar-Rahman Hamidi
6604ce63e8
Add singular and plural form for some validation messages
2014-05-02 18:32:11 +02:00
hakanensari
9be22bd8d8
Autoload ActiveModel::StrictValidationFailed
...
Currently, if environment doesn’t eager load code, invoking this
constant before calling #valid? on a model instance results in a
NameError.
2014-04-16 22:48:51 +01:00
Steve Agalloco
e412ccbb56
add missing parentheses to validates_with documentation [skip ci]
2014-04-04 11:54:05 -04:00
David Underwood
d93bfac207
Adds explanation of :base attribute to errors.add
...
[ci skip]
2014-03-27 16:13:56 -04:00
Henrik Nyh
2e70f44123
ActiveRecord/ActiveModel '#validate' alias for 'valid?'
...
It's unintuitive to call '#valid?' when you want to run validations but
don't care about the return value.
The alias in ActiveRecord isn't strictly necessary (the ActiveModel
alias is still in effect), but it clarifies.
2014-03-27 17:56:14 +01:00
Prem Sichanugrist
2dd2fcf896
Introduce Rails.gem_version
...
This method return `Gem::Version.new(Rails.version)`, suggesting a more
reliable way to perform version comparison.
Example:
Rails.version #=> "4.1.2"
Rails.gem_version #=> #<Gem::Version "4.1.2">
Rails.version > "4.1.10" #=> false
Rails.gem_version > Gem::Version.new("4.1.10") #=> true
Gem::Requirement.new("~> 4.1.2") =~ Rails.gem_version #=> true
This was originally introduced as `.version` by @charliesome in #8501
but got reverted in #10002 since it was not backward compatible.
Also, updating template for `rake update_versions`.
2014-03-05 12:37:38 -05:00
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
Carlos Antonio da Silva
c20fe91b05
Pass strings to demodulize method
...
Goes along with fea1cdcff4d50d302d8e8532432c3ab107ff816d and
59ec4562a2e70df455b2e44a67c340fa5254e26e.
2014-02-26 21:20:56 -03:00
Aaron Patterson
fea1cdcff4
pass the class name to tableize
...
We should not rely on to_s to return the name of the class
2014-02-26 15:02:57 -08:00
T.J. Schuck
53f1ab523b
Bump version of bcrypt gem
2014-02-25 09:52:32 -05:00
Yves Senn
c554d170e6
update version to 4.2.0.alpha
2014-02-23 13:14:43 +01:00
Rafael Mendonça França
1879c259b8
Merge branch '4-1-0-beta2'
...
Conflicts:
actionview/CHANGELOG.md
activerecord/CHANGELOG.md
2014-02-18 16:00:47 -03:00
Rafael Mendonça França
8b20c72dd8
Preparing for 4.1.0.beta2 release
2014-02-18 15:45:20 -03:00
Yves Senn
7d196cf360
#to_param
returns nil
if to_key
returns nil
. Closes #11399 .
...
The documentation of `#to_key` (http://api.rubyonrails.org/classes/ActiveModel/Conversion.html#method-i-to_key )
states that it returns `nil` if there are no key attributes. `to_param` needs
to be aware of that fact and return `nil` as well.
Previously it raised the following exception:
```
1) Error:
ConversionTest#test_to_param_returns_nil_if_to_key_is_nil:
NoMethodError: undefined method `join' for nil:NilClass
/Users/senny/Projects/rails/activemodel/lib/active_model/conversion.rb:65:in `to_param'
/Users/senny/Projects/rails/activemodel/test/cases/conversion_test.rb:34:in `block in <class:ConversionTest>'
```
2014-02-04 10:27:46 +01:00
Carlos Antonio da Silva
26fb57b58d
Fix doc markup of clear_validators!
2014-01-27 08:26:54 -02:00
Vince Puzzella
8855163bdb
Ability to specify multiple contexts when defining a validation.
...
Example:
validates_presence_of :name, on: [:update, :custom_validation_context]
2014-01-27 03:26:27 -05:00
Xavier Noria
0df1f91410
revises references to :allow_(nil|blank) in some docs [ci skip] [Steven Yang & Xavier Noria]
...
Closes #11247 .
2014-01-26 20:50:18 +01:00
Godfrey Chan
98705d88cd
Some minor fixes
2014-01-24 20:06:31 -08:00
Godfrey Chan
8ca59237dd
Got all the new tests passing
2014-01-24 19:49:30 -08:00
Godfrey Chan
20490adcbf
Restored the ability to clear the password with user.password= nil (see the docs)
2014-01-24 19:49:30 -08:00
Adrien Coquio
b97035df64
Fix ActiveModel::Errors#has_key? return value
2014-01-22 21:01:41 +01:00
Rafael Mendonça França
b8302bcfda
Forgot to push this change in the parent commit
2014-01-20 23:00:17 -02:00
Rafael Mendonça França
06a00038ef
When applying changes or reseting changes create the right class
...
Before this patch after the changes are applied the changes can be only
accessed using string keys, but before symbols are also accepted.
After this change every state of the model will be consistent.
2014-01-20 22:58:14 -02:00
Carlos Antonio da Silva
486db21f91
Fix eager load of Serializers on Active Model
2014-01-17 15:30:09 -02:00
Yves Senn
8c0d5e0d1c
doc proc/lambda arg on inclusion validation. Closes #13689 . [ci skip]
2014-01-13 11:25:58 +01:00
Carlos Antonio da Silva
3a33e8ea85
Use a better method name to check the requirement of password confirmation
...
Also improve changelog entries related to secure password to proper
highlight.
2014-01-07 07:59:44 -02:00
Carlos Antonio da Silva
a6da73f975
Fix typo in AMo docs [ci skip]
2014-01-06 08:45:21 -02:00
T.J. Schuck
72bb3fc297
Change all "can not"s to the correct "cannot".
2014-01-03 17:02:31 -05:00
Vipul A M
98cb3e69af
update copyright notices to 2014. [ci skip]
2014-01-01 23:59:49 +05:30
Vijay Dev
c4fb191a4c
Merge branch 'master' of github.com:lifo/docrails
2013-12-31 22:44:34 +05:30
Godfrey Chan
f3a8be3b8b
Merge pull request #13131 from gja/changed-accepts-values
...
Allows you to check if a field has changed to a particular value
2013-12-30 22:05:56 -08:00
Yves Senn
864514a460
Merge pull request #13483 from aditya-kapoor/add-missing-slashes
...
Adding missing backslashes in active_model files so as to avoid unwanted [ci skip]
2013-12-27 01:13:02 -08:00
aditya-kapoor
fe49f432c9
Adding missing backslashes in active_model files so as to avoid unwanted links in rdoc [ci skip]
2013-12-27 13:58:31 +05:30
aditya-kapoor
1dae89ccce
Added Backslashes to ActiveModel::AttributeMethods to prevent unwanted links in the rdoc + some other doc fixes.[ci skip]
2013-12-25 18:34:11 +05:30
Robin Dupret
6e2d35df3c
Fix few typos and improve markup at some levels
2013-12-24 12:39:41 +01:00
Robin Dupret
b894b7b90a
Fix few typos in the documentation [ci skip]
2013-12-21 18:59:55 +01:00
Vijay Dev
a3b1105ada
Merge branch 'master' of github.com:lifo/docrails
2013-12-20 00:10:30 +05:30
David Heinemeier Hansson
c0a2d474c5
Get ready to release 4.1.0.beta1
2013-12-17 16:05:28 -08:00
Tejas Dinkar
da2b05bb6b
Allows you to check if an attribute has changed to a particular value
...
model.name_changed?(from: "Pete", to: "Ringo")
2013-12-15 12:13:31 +05:30
Rafael Mendonça França
12affbe491
Fix typo [ci skip]
2013-12-13 18:33:30 -02:00
Godfrey Chan
f650981483
Added :nodoc: for attribute_changed?
and attribute_was
[ci skip]
...
These methods were made "public" in 47617ecd so that `method_missing`
can invoke them without going through `send`, but they aren't meant
for consumption from outside of Rails.
2013-12-12 12:04:07 -08:00
Akshay Vishnoi
5fccd77b6c
Spelling and Grammar checks
2013-12-12 18:28:34 +05:30
Aayush khandelwal
10fffd7ae6
typos rectified lifecycle => life cycle
2013-12-12 12:55:35 +05:30
aditya-kapoor
0c55335074
Merge branch 'master' of github.com:lifo/docrails
2013-12-10 11:44:07 +05:30
Carlos Antonio da Silva
05a685eeb7
Merge pull request #13145 from acapilleri/fix_email_example
...
fix email regex example code [ci skip]
2013-12-03 07:47:25 -08:00
Angelo capilleri
f590cdb656
fix email regex example code [ci skip]
...
different from the regex in EmailValidator
2013-12-03 16:44:39 +01:00
Lauro Caetano
b1b9a0aeca
Typos. return -> returns. [ci skip]
2013-12-03 13:31:36 -02:00
Genadi Samokovarov
6329d9fa8b
Remove deprecated cattr_* requires
2013-12-03 00:28:15 +02:00
Akshay Vishnoi
ef0f633c66
Typo and grammatical fixes [ci skip]
2013-12-02 19:35:02 +05:30
Xavier Noria
17c29a0df0
Merge remote-tracking branch 'docrails/master'
...
Conflicts:
activesupport/lib/active_support/core_ext/hash/deep_merge.rb
activesupport/lib/active_support/core_ext/hash/keys.rb
2013-11-24 20:00:24 +01:00