Commit Graph

1661 Commits

Author SHA1 Message Date
Aditya Kapoor
d770ec0909 remove unnecessary require for json serialization test cases 2014-06-24 00:03:02 +05:30
Yuki Nishijima
10adc2ee90 Delegate #model_name method to self.class 2014-06-22 19:14:25 -07:00
Robin Mehner
64a05a928c only_integer of NumericalityValidator now allows procs and symbols 2014-06-22 12:22:27 +02:00
Zachary Scott
5b368010f6 ✂️ and 💅 from d60c405 [ci skip] 2014-06-16 11:35:43 -07:00
Aditya Kapoor
eb5d802cab [ci skip] correct doc for serialization in accordance with API Doc Guide 2014-06-16 22:26:55 +05:30
Akshay Vishnoi
73dc6d790c Correct typo, add test for validates_absence_of, correct method names 2014-06-16 08:22:11 +05:30
Godfrey Chan
0ab163d9c6 Edit pass on has_secure_password documentation [ci skip] 2014-06-14 11:05:39 -07:00
Akshay Vishnoi
fb48fccc25 [ci skip] Update #has_secure_password docs 2014-06-14 19:18:24 +05:30
Akshay Vishnoi
9bc91260ac Use @existing_user while updating existing user, fixing - #ee4e86 2014-06-14 14:42:52 +05:30
Godfrey Chan
ee4e86fa4b Cleaned up the has_secure_password test cases
* Grouped the valid test cases in one place
* Make the length of the generated password obvious
* Removed two wrong (copy-and-pasted) test cases
2014-06-14 00:43:47 -07:00
Godfrey Chan
c416bb8729 Added changelog for #15708 [ci skip] 2014-06-14 00:32:31 -07:00
Akshay Vishnoi
cabbc8f6a5 SecurePassword - Validate password must be less than or equal to 72
See #14591, Reason - BCrypt hash function can handle maximum 72 characters.
2014-06-14 12:35:31 +05:30
Arthur Nogueira Neves
6071d626e5 Merge pull request #15690 from deeeki/activemodel_model_doc
[ci skip] Clarify ActiveModel::Model docs
2014-06-13 12:21:46 -05:00
deeeki
8a1468eef6 [ci skip] Clarify ActiveModel::Model docs
ActiveModel attributes initialized with String return String values
2014-06-14 02:13:50 +09:00
Aditya Kapoor
bb075e3839 [ci skip] correct docs for conversion 2014-06-11 23:29:23 +05:30
Aditya Kapoor
2399207789 [ci skip] add tests for ActionModel::Conversion 2014-06-11 23:18:47 +05:30
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
Adrien Coquio
1c2c552703 Add failing test for ActiveModel::Errors#has_key? method
From the doc, this method should return false and not nil if there is no errors for this key
2014-01-22 15:49:08 +01:00
Rafael Mendonça França
fc913d4016 Fix typo 2014-01-21 22:38:07 -02: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
Godfrey Chan
87323487ce Merge pull request #13442 from aditya-kapoor/update-docs
Updated documentation for Attribute Methods [ci skip]
2013-12-26 02:02:53 -08:00
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
Carlos Antonio da Silva
7530c82e82 Disable locale checks to avoid warnings in Active Model tests [ci skip]
Missed AMo when adding to the other components in
ae196e85ee7169700afac2eecdc276bc06b10b8d.
2013-12-23 17:51:07 -02: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
Akira Matsuda
a3ebe7f3a7 Unused classes in AMo tests 2013-12-19 18:31:11 +09:00
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
Rafael Mendonça França
b34352e425 Merge pull request #13255 from strzalek/bump-builder
Bump up builder
2013-12-12 12:22:21 -08: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
Łukasz Strzałkowski
9f506c494b More liberal builder dependency
Allowing us to get 3.2.x versions if needed.
2013-12-12 20:03:02 +01:00
Akshay Vishnoi
5fccd77b6c Spelling and Grammar checks 2013-12-12 18:28:34 +05:30
Yves Senn
6f3c3ba784 Merge pull request #13287 from aayushkhandelwal11/typo_rectified
typos rectified lifecycle => life cycle
2013-12-11 23:32:04 -08:00
Aayush khandelwal
10fffd7ae6 typos rectified lifecycle => life cycle 2013-12-12 12:55:35 +05:30
Rafael Mendonça França
5853c64a4b Revert "Merge pull request #13276 from aayushkhandelwal11/change_to_key"
This will call primary_key two times

This reverts commit d0588a2e897d33c6c12e9fc5f8680328d37a26ca, reversing
changes made to 87e1e86640fb8b5a260ff7c0044aaae58fff2bc4.
2013-12-11 13:43:28 -02:00
Rafael Mendonça França
d0588a2e89 Merge pull request #13276 from aayushkhandelwal11/change_to_key
removing multiple check conditions to single check condition
2013-12-11 06:22:42 -08:00
Aayush khandelwal
1889dcbc9f removing multiple check conditions to single check condition 2013-12-11 19:36:25 +05:30
Guillermo Iguaran
87e1e86640 Merge pull request #13273 from robertomiranda/test-remove-require
Remove require 'models/administrator', Administrator is not used in secure password test
2013-12-11 05:39:14 -08:00
robertomiranda
df7e5b69de Remove require 'models/administrator', Administrator is not used in secure password test 2013-12-11 08:34:28 -05:00
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
Yves Senn
7c6d99e81e first pass through CHANGELOGS to extract 4_1_release_notes. [ci skip]
Extract **notable changes**, **deprecations** and **removals** from
each CHANGELOG.

I tried to reference the commits and pull requests for new features
and deprecations.

In the process I also made some minor changes to the CHANGELOGS.

The 4_1_release_notes guide is declared WIP.
2013-11-28 17:24:15 +01:00
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
Carlos Antonio da Silva
aa7fdfb859 Remove short circuit return in favor of simple conditional 2013-11-15 01:11:57 -02:00
Carlos Antonio da Silva
374d465f28 Invert conditional to avoid double checking for Regexp 2013-11-15 01:04:57 -02:00
Carlos Antonio da Silva
9014a79436 Only check that the option exists once instead of doing on each conditional 2013-11-15 01:01:59 -02:00
Carlos Antonio da Silva
61fef76106 Remove argument that is accessible as attribute 2013-11-15 01:00:53 -02:00
Carlos Antonio da Silva
b8c6c08452 Cache regexp source on format validation to avoid allocating new objects
Example:

    >> r = /some-regexp/
    => /some-regexp/
    >> r.source.object_id == r.source.object_id
    => false
2013-11-15 00:38:55 -02:00
Carlos Antonio da Silva
70161ae3b8 Make code simpler to read by using a case statement 2013-11-15 00:24:54 -02:00
Carlos Antonio da Silva
12815e0d44 Avoid a new hash allocation 2013-11-15 00:24:54 -02:00
Carlos Antonio da Silva
4c7e3a3087 Use a simple conditional rather than short circuit with next 2013-11-15 00:19:03 -02:00
Carlos Antonio da Silva
d2992818e0 Simplify number parsing logic in numericality validation 2013-11-15 00:07:22 -02:00
Carlos Antonio da Silva
f70e30ec6d Avoid creation of extra hash with merge just to set a value 2013-11-15 00:07:22 -02:00
Prem Sichanugrist
efff6c1fd4 Change syntax format for example returned values
According to our guideline, we leave 1 space between `#` and `=>`, so we
want `# =>` instead of `#=>`.

Thanks to @fxn for the suggestion.

[ci skip]
2013-11-11 13:53:54 -05:00
Carlos Antonio da Silva
deaf285824 Merge pull request #12686 from kryzhovnik/master
Minor doc fix of ActiveModel::Naming. [ci skip]

Conflicts:
	activemodel/lib/active_model/naming.rb
2013-11-02 14:46:56 -02:00
Andrey Samsonov
fb6f02c521 Minor doc fix of ActiveModel::Naming.
- qoute example line's result when it kind of String
- right ("singular_route_key") method in example
2013-10-29 15:23:03 +04:00
Guillermo Iguaran
c31b900221 Merge pull request #12635 from mperham/4-0-stable
Allow any version of BCrypt
2013-10-24 19:31:13 -02: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
T.J. Schuck
5d7b413d84 Use bcrypt's public cost attr, not internal constant
See:

- https://github.com/codahale/bcrypt-ruby/pull/63
- https://github.com/codahale/bcrypt-ruby/pull/64
- https://github.com/codahale/bcrypt-ruby/pull/65
2013-10-10 11:46:59 -04:00
Arun Agrawal
31488dba85 observers are not part of ActiveModel [ci skip] 2013-10-09 14:25:16 +02:00
Vijay Ubuntu
27576df810 adding load_path to include active_model in the load path of example
similar to activerecord/examples/simple.rb
2013-10-09 01:52:55 +05:30
Rafael Mendonça França
c48c111bb2 Merge pull request #8791 from griffinmyers/master
Updated DirtyModel's @changed_attributes hash to be symbol/string agnostic

Conflicts:
	activemodel/CHANGELOG.md
2013-10-03 11:37:10 -03:00
T.J. Schuck
4a99e10199 bcrypt-ruby v3.1.2 supports Ruby 2.0 on Windows 2013-09-23 14:28:26 -04:00
Rafael Mendonça França
ed0b080cb3 Fix the documentation method.
It is reload! in the class definition.

[ci skip]
2013-09-23 11:25:43 -03:00
Rafael Mendonça França
7ef29140eb No need to abbreviate ActiveModel
[ci skip]
2013-09-23 11:01:43 -03:00
Rafael Mendonça França
089e1b6426 Document reset_changes since it is part of public API
[ci skip]
2013-09-23 11:00:56 -03:00
Rafael Mendonça França
9aa1a3d853 Merge pull request #10816 from bogdan/less-dirty-dirty
Make AM::Dirty less dirty to plugin into AR or other library
2013-09-23 10:59:05 -03:00
Rajarshi Das
782d794c20 use assert_empty in activemodel conditional validation test cases 2013-09-10 17:26:39 +05:30
Rajarshi Das
e21a18bed0 fix actionview and activemodel test cases typos 2013-09-05 14:21:57 +05:30
aditya-kapoor
6b9b0767bf Merge branch 'master' of github.com:lifo/docrails 2013-09-01 18:05:04 +05:30
Gaurish Sharma
65f1766a08 Add :nodoc: to ActiveModel::SecurePassword.min_cost
[ci skip]
2013-08-29 01:27:18 +05:30
Rajarshi Das
9f478deaab remove unused instance variable 2013-08-23 16:04:08 +05:30
aditya-kapoor
b27c40637a fixed a typo 2013-08-20 14:21:36 +05:30
Guillermo Iguaran
99e33c03b7 Dont' check for any order in hash since we aren't sorting it and this is determinated only by the used interpreter 2013-08-18 16:40:21 -05:00
Guillermo Iguaran
c40111c346 Refactor serialization test for hash order 2013-08-18 09:04:09 -05:00
Gaurish Sharma
90c450f6cd Avoid Skip in test, have a unified test for order 2013-08-09 15:27:21 +05:30
Gaurish Sharma
9f8116fb77 Add tests for ActiveModel::Serializers::JSON#as_json ordering 2013-08-09 04:32:00 +05:30
Ryoji Yoshioka
23ef1dfd70 Fix: documentation for ActiveModel::Errors 2013-08-05 18:58:22 +09:00
Max Shytikov
af1e3b7c48 fix tests 2013-07-30 20:03:57 +03:00
Arun Agrawal
f52832de2a grab executable from rubygems
As done here d7fc97d3f90c0e30865d32ce202658f03248cacc
2013-07-26 11:07:25 +02:00
Vladimir Kiselev
3be0cdfa55 Fix secure_password password_confirmation validations 2013-07-24 03:14:15 +04:00
Burkhard Vogel-Kreykenbohm
ad62cf68f8 bcrypt-ruby stable is 3.1 2013-07-17 16:39:07 +02:00
John Gesimondo
0e945f8909 it's xml, not json
change docs for xml serializer to talk about xml
2013-07-13 16:25:04 -07:00
Ankit Gupta-FIR
6a71d09ad2 Replaced older rocket sign to new : 2013-07-04 17:25:50 +01:00
Aaron Patterson
09b31f08d4 eagerly initialize the attributes module to avoid check-then-set race conditions 2013-07-02 14:34:40 -07:00
Aaron Patterson
4c88f4ce16 remove wrong documentation from a :nodoc:'d method 2013-07-02 14:04:40 -07:00
Aaron Patterson
d094aaad19 the data structure used to store attribute aliases should not be exposed 2013-07-01 16:23:08 -07:00
Vipul A M
404a61e19c Remove redundant escapes from xml serialization test 2013-07-01 10:17:33 +05:30
Steven Yang
6e583cdac3 fix typo in ActiveModel::Error docs [ci skip] 2013-06-30 18:38:29 -03:00
Steven Yang
5fe43ffcfb remove evals from AM::Validations::Callbacks
follow the same refactor at a63a964a5d1ed02cf0df1b1a33a96ed2a9fa987b
2013-06-30 18:47:55 +08:00
Steven Yang
e8fe6660d2 provide a more sementicthe local variables name for ActiveModel::Validations::Clusivity#include? method
the original name `exclusion` is a bit confusing when using with the method `inclusion_method`
rename it to a more logic neutral name.
2013-06-29 18:36:40 +08:00
Paul Nikitochkin
e63ba910ae Remove deprecation warning from AttributeMethodsMatcher 2013-06-28 00:16:42 +03:00
Łukasz Strzałkowski
468939297d Remove deprecated attr_protected/accessible
Rails 4.0 has removed attr_protected and attr_accessible feature in favor of Strong Parameters.
2013-06-27 20:38:30 +02:00
Carlos Antonio da Silva
48ab2c06e0 Merge pull request #11054 from senny/11048_make_default_value_explicit
make default value for `:message` on `AM::Errors` explicit.
2013-06-27 05:16:38 -07:00
Carlos Antonio da Silva
61346d1b42 Merge pull request #10774 from chuckbergeron/validates-inclusion-of-accuracy-for-non-numeric-ranges
Greater accuracy for validates_inclusion_of on non-numeric ranges

Closes #10774, fixes #10593
2013-06-25 21:48:41 -03:00
Akshay Khole
444d3412b9 Fixing Issue #11083
Removing other occurrences of `the` appearing twice
2013-06-25 16:47:29 +05:30
Rajarshi Das
cbd4a2e317 replace all older rocket sign to new ":" from examples of active record and active models 2013-06-24 11:19:51 +05:30
José Valim
e1f4f64434 Revert "Merge pull request #11053 from yangchenyun/mine"
Those two files are required by active_support/rails.rb
loaded in active_model.rb

It is common to require common dependencies on the root
files to avoid boilerplate in each file.

This reverts commit 763635e30f17800ebc0a8ae98d780edc8ebfb4e5, reversing
changes made to 4f46ef36aaef217834f3f96d3689d32f6a6761ea.
2013-06-22 18:36:26 +02:00
Yves Senn
ca99ab2481 make default value for :message on AM::Errors explicit. 2013-06-22 13:48:42 +02:00
Yves Senn
763635e30f Merge pull request #11053 from yangchenyun/mine
Add explicit dependencies of ActiveSupport to enable independent usage of ActiveModel::Name
2013-06-22 03:32:15 -07:00
Steven Yang
c20b5ca037 add explicit AS dependencies for ActiveModel::Naming
There are two missing ActiveSupport dependencies to use ActiveModel::Name class or ActiveModel::Naming module independently.

Missing dependencies for Module#delegate defined in `active_support/core_ext/module/delegation`, used at [L148](https://github.com/rails/rails/blob/master/activemodel/lib/active_model/naming.rb#L148)

Missing dependencies for Object#blank? defined in `active_support/core_ext/object/blank`, used at [L131](https://github.com/rails/rails/blob/master/activemodel/lib/active_model/naming.rb#L131)
2013-06-22 18:24:29 +08:00
Arun Agrawal
67f668845e Saying gemcutter => rubygems [ci skip] 2013-06-21 11:04:52 +02:00
Fred Wu
85750d43fa ActiveModel::Model inclusion chain backward compatibility 2013-06-20 12:16:17 +10:00
Fred Wu
0b502cb879 Fixes AciveModel::Model with no ancestors, fixes #11004
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2013-06-19 17:16:04 +02:00
Fred Wu
e3dc10f133 Fixed ActiveModel::Model's inclusion chain 2013-06-19 11:25:10 +10:00
Aaron Patterson
47617ecdf7 expose a few attribute changed methods 2013-06-11 13:39:46 -07:00
Aaron Patterson
a63a964a5d remove some evals from callback conditionals 2013-06-11 10:20:29 -07:00
Daichi Arai
d61241b060 fix ActiveModel::Validations.validators_on doc 2013-06-10 18:34:34 +09:00
Carlos Antonio da Silva
94725b81f5 Merge pull request #10860 from ka8725/activemodel_log
Ignore activemodel/log/ folder
2013-06-07 05:27:29 -07:00
Richard Livsey
9906eb1355 Docfix: Use public interface instead of setting instance variables
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.
2013-06-07 12:41:05 +02:00
Andrey Koleshko
120f6e07f6 Stub logger for tests 2013-06-06 19:47:57 +03:00
Arun Agrawal
a84a08ecea No need to load 'rake/packagetask' as it's already
in 'rubygems/package_task'
2013-06-02 20:41:21 +02:00
Phil Calvin
5d93ef8f45 Fix regression in has_secure_password.
If the confirmation was blank, but the password wasn't, it would still save.
2013-05-30 11:18:43 -07:00
Charles Bergeron
0317b93c17 Use Range#cover? for Numeric ranges (tests via endpoints) and use Range#include? for non-numeric ranges
added changelog message
2013-05-27 23:54:25 -07:00
William Myers
0e655873d4 DirtyModel uses a hash to keep track of any changes made to attributes
of an instance. When using the attribute_will_change! method, you must
supply a string and not a symbol or the *_changed? method will break
(because it is looking for the attribute name as a string in the keys
of the underlying hash). To remedy this, I simply made the underlying
hash a HashWithIndifferentAccess so it won't matter if you supply
the attribute name as a symbol or string to attribute_will_change!.
2013-05-27 23:41:26 -04:00
Nick Sutterer
7d84c3a2f7 deprecate Validator#setup (to get rid of a respond_to call). validators do their setup in their constructor now. 2013-05-23 10:00:44 -03:00
Aaron Patterson
9fef7c8dc9 Merge pull request #10527 from zenspider/squishy_minitest5
Squishy minitest5
2013-05-16 13:41:54 -07:00
Aaron Patterson
ba55276434 deprecating string based terminators 2013-05-14 16:03:09 -07:00
Aaron Patterson
d53b5f0739 Merge branch 'master' into normalizecb
* master: (61 commits)
  add tests for reset_calbacks
  Fixing build broken by this change
  Extract variable out of loop
  Updated comment to Rails 4
  Fixes NoMethodError: `alias_method_chain` when requiring just active_support/core_ext
  better error message when app name is not passed in `rails new`
  Code cleanup for ActionDispatch::Flash#call
  Fix typo: require -> requires
  Add CHANGELOG entry for #10576
  Merge pull request #10556 from Empact/deprecate-schema-statements-distinct
  Some editorial changes on the documentation.
  respond_to -> respond to in a message from AM::Lint
  specify that dom_(id|class) are deprecated in controllers, views are fine
  copy edits [ci skip]
  Fix class and method name typos
  Replace multi_json with json
  ruby -> Ruby
  Adding documentation to the automatic inverse_of finder.
  Improve CHANGELOG entry [ci kip]
  Call assume_migrated_upto_version on connection
  ...

Conflicts:
	activesupport/lib/active_support/callbacks.rb
2013-05-13 11:51:10 -07:00
Xavier Noria
19c6c8f5d7 respond_to -> respond to in a message from AM::Lint
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.
2013-05-12 13:59:51 +02:00
Aaron Patterson
23122ab2d4 callbacks are wrapped with lambdas 2013-05-10 10:13:21 -07:00
wangjohn
eb93d16e49 Using define method instead of class eval when defining model callbacks.
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)
2013-05-08 13:47:56 -04:00
Ryan Davis
3073c53198 Updates to make rails 4 happy with minitest 5:
+ Namespace changes, overhaul of runners.
+ Internal ivar name changes
- Removed a logger globally applied to tests that spew everywhere?!?
+ Override Minitest#__run to sort tests by name.
+ Reworked testing isolation to work with the new cleaner architecture.
- Removed a bunch of tests that just test minitest straight up. I think these changes were all merged to minitest 4 a long time ago.
- Minor report output differences.
2013-05-06 17:38:45 -07: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
Rafael Mendonça França
feb44b9213 rails/master is now 4.1.0.beta 2013-04-29 13:15:24 -03:00
David Heinemeier Hansson
1ec64297f9 Bump version to rc1 2013-04-29 08:29:18 -07:00
Xavier Noria
31aab3ee57 pass over the code comments
* 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.
2013-04-28 12:03:59 +02:00
Carlos Antonio da Silva
3e47e193c6 Merge pull request #10286 from neerajdotname/fix-wrong-test-name-and-failure-message
fix wrong test description and failure message
2013-04-21 09:22:51 -07:00
Neeraj Singh
2242317fdd fix wrong test description and failure message 2013-04-21 12:00:38 -04:00
Neeraj Singh
cf69d527fe Added tests for if condition in Active Model callbacks 2013-04-21 11:34:12 -04:00
Yves Senn
068289f239 align the result of expressions vertically [ci skip]. 2013-04-12 17:22:39 +02:00
Yves Senn
c245437de7 use unified and clean formatting in CHANGELOGS. [ci skip] 2013-04-12 15:52:43 +02:00
Anupam Choudhury
e000aa92dd Removed unused setup 2013-04-09 20:57:55 +05:30
Sam Ruby
04cda1848c Prefer find_by over dynamic finders in rdoc 2013-04-02 15:09:15 -04:00
Carlos Antonio da Silva
09c55dcc5d Review some tests from AMo::Errors to remove "should" usage
Also remove duplicated tests for Errors#as_json and minor improvements
in some tests.
2013-03-30 15:04:09 -03:00
Carlos Antonio da Silva
3d0c0c6c95 Improve changelog entry for ActiveModel::Errors#full_messages_for [ci skip]
Add a working example of how to use this new method.
2013-03-30 14:38:13 -03:00
Vijay Dev
6d8c070821 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
	activerecord/test/cases/adapter_test.rb
	guides/source/testing.md

[ci skip]
2013-03-30 15:46:14 +05:30
Rafael Mendonça França
b8b3df0e63 Merge pull request #8527 from shockone/patch-1
Add a method full_messages_for to the Errors class
2013-03-25 09:04:25 -07:00
Rafael Mendonça França
ba012fa04d Merge pull request #9864 from vipulnsward/fix_test_AR_v2
Introduce test on Error#full_message for attribute with underscores; Fix...
2013-03-25 08:56:29 -07:00
shock_one
ec1b715b0e Add a method full_messages_for to the Errors class 2013-03-24 09:38:28 +02:00
Rafael Mendonça França
e600384515 Merge pull request #8501 from charliesome/version-to-s
Add #to_s method to VERSION modules
2013-03-23 18:51:16 -07:00
Prathamesh Sonpatki
5f59317ec6 Fixed typo in activemodel/CHANGELOG 2013-03-24 02:27:43 +05:30
Prathamesh Sonpatki
33d1e37408 Reverted change in activemodel/CHANGELOG.md introduced by d45145acdc576e46a1f1719d69bec96b5bf07b0a 2013-03-24 02:14:21 +05:30
Prathamesh Sonpatki
d45145acdc Changed 'args' to 'arguments' when used in places other than code with fixing few more typos 2013-03-24 00:34:06 +05:30
Carlos Antonio da Silva
a03ab8cef8 Remove exception variable from rescue block
Just raising from the rescue block will re-raise the exception, so the
variable is not necessary.
2013-03-22 14:00:06 -03:00
Vipul A M
24fee97581 Add Error#full_message test; Fix typos
Introduce test on Error#full_message for attribute with underscores; Fix
some typos
2013-03-22 14:53:32 +05:30
robertomiranda
7e07b7bb5d Change Standard error when is required bcrypt-ruby and fails 2013-03-21 22:52:42 -05:00
Charlie Somerville
c07e1515f7 Add version method to top level modules 2013-03-21 19:56:07 +11:00
Intrepidd
9c025ab6e9 Tidying up some require : removing useless sort and homogenizing with the rest of the code the wat the includes are done 2013-03-20 18:24:48 +00:00
wangjohn
3ee30ca44a The repair_validations helper was not working correctly before because
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.
2013-03-19 12:23:20 -04:00
Xavier Noria
ddd2c75b26 Revert "instruct RDoc to only parse Ruby files under lib [Fixes #9779]"
This reverts commit c24528fbc94dea9946a563be3bed9559583bdc57.
2013-03-18 21:19:47 +01:00
Xavier Noria
c24528fbc9 instruct RDoc to only parse Ruby files under lib [Fixes #9779] 2013-03-18 20:36:32 +01:00
Vipul A M
233737706c fix some typos found in activemodel 2013-03-18 17:20:05 +05:30
Vipul A M
29dcf096b0 Small typos here and there. 2013-03-15 11:55:03 +05:30
Waynn Lue
008fd54e74 clarify verbiage 2013-03-12 18:44:10 -07:00
Carlos Antonio da Silva
b3a31e9363 Fix AMo code example indent, add missing author to entry [ci skip] 2013-03-09 14:57:31 -03:00
Rafael Mendonça França
cf09ac380e Merge pull request #9545 from senny/9535_secure_password_blank
`has_secure_password` is not invalid when assigning empty Strings
2013-03-07 08:05:05 -08:00
Vijay Dev
6ea48ebfa6 Merge branch 'master' of github.com:lifo/docrails 2013-03-05 22:51:48 +05:30
Yves Senn
8c1687bbf8 has_secure_password is not invalid when assigning empty Strings.
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?`.
2013-03-04 18:56:05 +01:00
Yves Senn
b501ee47fa validates_confirmation_of does not override writer methods. 2013-03-04 18:51:34 +01:00
Lebin Sebastian F
50b3b968d4 Small Typo 2013-03-04 13:23:23 +05:30
Rafael Mendonça França
0f75e2c51f Update CHANGELOGS 2013-02-26 13:45:57 -03:00
David Heinemeier Hansson
c0bc9ce38c Preparing for 4.0.0.beta1 release 2013-02-25 08:31:50 -06:00
Xavier Noria
05857ec30e did a pass over the AM changelog [ci skip] 2013-02-24 20:37:15 +01:00
Angelo capilleri
40c1ee8b7d added more accurate test for add_on_empty
with the current tests, if delete the assignment of is_empty in add_on_empty method
the tests not fail. With this test, if we delete is_empty, the test fails
2013-02-19 18:48:37 +01:00
Vijay Dev
0c145448c4 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/upgrading_ruby_on_rails.md
2013-02-15 22:06:17 +05:30
Henrik Nyh
53c22e097a Clarify ActiveModel::Validator initialization in docs.
As discussed with @josevalim on Ruby Rogues Parley.
2013-02-09 15:54:14 +01:00
Rafael Mendonça França
e16110c4b8 Take care of whitespaces and changing the hash syntax 2013-02-04 09:59:22 -02:00
David
6e2cba1c8b test for issue 8931 2013-02-02 13:00:52 +08:00
Akira Matsuda
ee4a2bb23d Missing require extract_options 2013-01-31 23:45:36 +09:00
Attila Domokos
69b6129fd4 Adding the route_key and param_key tests
This way all the tests are testing the same fields
2013-01-22 22:13:43 -05:00
Guillermo Iguaran
8aebe30ef4 Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by"
This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing
changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1.
2013-01-18 09:15:19 -05:00
robertomiranda
7baecc4802 User Rails 4 find_by 2013-01-18 07:56:05 -05:00
Carlos Antonio da Silva
203f787321 Merge pull request #8940 from adomokos/adding_tests_for_changed_attributes
Cleaning up ActiveModel::Dirty tests
2013-01-15 13:02:57 -08:00
Attila Domokos
63333e600f Cleaning up ActiveModel::Dirty tests
* Clarifying what the #changed method returns
* Adding tests to describe what the #changed_attributes returns
* Updating test name based on pull request comment
* Moving the test lower in the file per pull request comment
2013-01-15 10:24:57 -05:00
Trung Lê
86c4fe8191 ActiveRecord <-> Active Record [ci skip] 2013-01-15 10:52:02 +00:00
Yves Senn
bc19c0d09c test for ActiveModel::Conversion#to_partial_path and namespaced models 2013-01-14 21:17:22 +01:00
Attila Domokos
01434a5ee6 Adding tests for ActiveModel::Model
* Verifying persisted? is false when Model initialized
* Passing nil to Model should not blow up
* Changing test name to the one suggested in pull request comment
2013-01-12 20:04:24 -05:00
Attila Domokos
7171f9cc8f Covering untested methods for ActiveModel::Errors 2013-01-10 21:41:35 -05:00
Irio Irineu Musskopf Junior
d4f46ee4fd Set default value to ActiveModel::Validator initializer attribute
Makes it easier to test its objects.
2013-01-09 13:50:27 -02:00
Vijay Dev
f049016cd3 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/getting_started.md
2013-01-09 01:04:15 +05:30
Gosha Arinich
0acf92184d prefer american spelling of 'behavior' 2013-01-07 11:47:27 +03:00
Akira Matsuda
3c21237c37 Reduce number of Strings a bit 2013-01-07 07:37:23 +09:00
Akira Matsuda
c8e632bd9f Namespace HashWithIndifferentAccess 2013-01-07 07:37:23 +09:00