Commit Graph

1445 Commits

Author SHA1 Message Date
Vijay Dev
4aa25d4c76 fix typo in changelog [ci skip] 2014-06-11 15:01:28 +05:30
Yves Senn
daaf62c16b Merge pull request #15635 from kuldeepaggarwal/add-missing-changelog
add missing changelog entry. refer [#16db90d] [ci skip]
2014-06-11 09:05:18 +02:00
Kuldeep Aggarwal
aec4127fa1 add missing changelog entry. refer [#16db90d] [ci skip] 2014-06-11 11:38:06 +05:30
Kuldeep Aggarwal
e5cc892ce6 remove depricated Validatior#setup 2014-06-10 12:27:17 +05:30
Zachary Scott
4c66ab2b21 Feature requests should be made on the mailing list, not submitted to
the issue tracker. See also #15455 [ci skip]
2014-06-01 19:11:39 -07:00
Akshay Vishnoi
fd3f3c5348 [ci skip] Include ActiveModel::Model in a class instead of inheriting 2014-05-30 03:09:57 +05:30
ShunsukeAida
33cc907305 Name#model_name doesn't return a String object 2014-05-30 00:09:41 +09:00
Rafael Mendonça França
5508a3e5ca Merge pull request #15154 from msgehard/move_password_field
Put attr_reader in with all of the other instance methods
2014-05-20 20:24:51 -03:00
Mike Gehard
8dd801d6ca Let others know why this code is here
[ci skip]
2014-05-18 06:47:37 -06:00
Mike Gehard
41f7d07da3 Put attr_reader in with all of the other instance methods
This makes the grouping make a little more sense
2014-05-17 13:45:35 -06:00
Yves Senn
8109dc8067 formatting pass through CHANGELOGS. [ci skip] 2014-05-16 09:03:26 +02:00
Abd ar-Rahman Hamidi
6604ce63e8 Add singular and plural form for some validation messages 2014-05-02 18:32:11 +02:00
Robin Dupret
5c87c95a71 Enhance a bit a few changelog entries [ci skip] 2014-05-02 11:56:03 +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
Musannif Zahir
8753ce1a37 Fix warning for overshadowing XML variable 2014-03-28 20:11:58 +08:00
David Underwood
d93bfac207 Adds explanation of :base attribute to errors.add
[ci skip]
2014-03-27 16:13:56 -04:00
Rafael Mendonça França
eddcdb0f1d Add CHANGELOG to Active Model too [ci skip] 2014-03-27 14:16:57 -03: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
Yves Senn
6868265fe3 comment why we are modifying global state. [ci skip] 2014-03-11 08:34:51 +01:00
Zuhao Wan
cc6bc1cc46 Completely remove potential global state leaks in ActiveModel tests.
ActiveModel tests can now be run in random order.
2014-03-11 00:48:25 +08:00
Yves Senn
29bd586fed Merge pull request #14315 from zuhao/activemodel_tests_in_random_order
Run ActiveModel test suites in random order.
2014-03-09 21:03:13 +01:00
Zuhao Wan
9ffeb36265 Run ActiveModel test suites in random order.
This gets the whole ActiveModel test suites working even if
`self.i_suck_and_my_tests_are_order_dependent!` is disabled
in `ActiveSupport::TestCase`.

Two places are found that potentially leak global state. This patch
makes sure states are restored so that none of the changes happen in
a single test will be carried over to subsequence tests.
2014-03-10 03:52:51 +08:00
Peter Markou
f6ab778297 Fix errors for four of the code samples
The four code samples that fail to run are:

- Add attribute magic to objects. Fixed by introducing a Person
  instance variable.

- Tracking value changes. Fixed by replacing `attr_accessor` with
  `define_attribute_methods`, providing getter and setter methods
  for `name` and providing the missing `Person#save` method. A
  call to `Person#save` has to precede the `person.name = 'robert'`
  assignment, if we want `previous_changes` to include 'bob'.

- Adding `errors` interface to objects. Fixed by introducing a
  Person instance variable, assigning `nil` to its name and calling
  `Person#validate!`.

- Custom validators. Fixed by defining `HasNameValidator` before
  it is used by `ValidatorPerson`.

All the code samples can now be run smoothly.

Call Dirty#changes_applied in Person#save, instead of modifying instance vars.
2014-03-08 21:19:42 +02:00
Pavel Penkov
62e8145430 Tests for indifferent access using full_messages_for. Closes #11916 2014-03-08 13:28:43 +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
Carlos Antonio da Silva
71b3910a7d Point master changelogs to 4-1-stable branch
Remove 4-1 related entries from master [ci skip]
2014-02-25 09:14:36 -03: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
Dmitry Polushkin
8acd58f23c add test coverage for activemodel Dirty#reset_changes 2014-02-09 18:44:24 +00: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
Yves Senn
02f9f33142 tidy CHANGELOGs [ci skip] 2014-01-30 11:12:46 +01:00
Kuldeep Aggarwal
20317f3d4d use the new clear_validators! api everywhere to reset validators in tests 2014-01-28 00:13:35 +05:30
Carlos Antonio da Silva
26fb57b58d Fix doc markup of clear_validators! 2014-01-27 08:26:54 -02:00
Carlos Antonio da Silva
801baeed69 Use the new clear_validators! api to reset validators in tests 2014-01-27 08:26:54 -02:00
Carlos Antonio da Silva
5336ce265a Merge tests about multiple validation contexts 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
b6ddbfb158 Removed old tests 2014-01-24 19:49: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
Godfrey Chan
19a4ef305d Rewrote the tests for has_secure_password 2014-01-24 19:49:30 -08:00
Adrien Coquio
db95c7dceb Update ActiveModel::Errors.has_key? test 2014-01-22 21:26:53 +01:00
Adrien Coquio
b97035df64 Fix ActiveModel::Errors#has_key? return value 2014-01-22 21:01:41 +01:00