Renato Mascarenhas
cf7ab6056a
Reset attributes should not report changes.
...
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
~~~
2012-12-01 16:58:09 -02:00
Rafael Mendonça França
ccecab3ba9
Remove observers and sweepers
...
They was extracted from a plugin.
See https://github.com/rails/rails-observers
[Rafael Mendonça França + Steve Klabnik]
2012-11-28 22:46:49 -02:00
Steve Klabnik
9504b44cf6
Specify type of singular association during serialization
...
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
2012-11-28 11:48:32 -08:00
Rafael Mendonça França
5658923daa
Merge pull request #7282 from xHire/validates_length_of_fix
...
Length validation handles correctly nil. Fix #7180
Conflicts:
activemodel/CHANGELOG.md
2012-11-26 18:44:07 -02:00
Michal Zima
ea76e9a312
Length validation handles correctly nil. Fix #7180
...
When nil or empty string are not allowed, they are not valid.
2012-11-26 12:34:32 +01:00
Yves Senn
22598ee599
cleanup, removed dispensable require
statements from ActiveModel
2012-11-25 17:08:57 +01:00
Yves Senn
b7edbc718b
cleanup, remove broken whitespace
2012-11-25 16:57:29 +01:00
Saulius Grigaliunas
61edea05c3
Point user to strong_parameters as the new protection model [ci skip]
2012-11-18 15:40:41 +02:00
Carlos Antonio da Silva
0b63da9d5a
Initialize #min_cost to avoid warning in Ruby 2.0
2012-11-17 18:40:01 -02:00
Vijay Dev
7b70eeed43
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
actionpack/lib/action_dispatch/routing/redirection.rb
2012-11-17 01:50:49 +05:30
Trevor Turk
06faa6da80
Use BCrypt's MIN_COST in the test environment for speedier tests
2012-11-14 09:42:54 -06:00
Daniel Lopes
d7536e6108
add details on password confirmation used with has_secure_password
2012-11-13 17:31:46 -06:00
Dennis Taylor
ba291a67df
Trivial documentation fix for ActiveModel::Naming comment.
2012-11-09 11:23:51 -08:00
Aaron Patterson
72f5085404
rm dead code
2012-11-09 10:31:23 +09:00
Vasiliy Ermolovich
70ecf6c518
use Array() instead flatten
...
* move ActiveModel::Errors tests to errors_test.rb
* add spec coverage for add_on_empty and add_on_blank
2012-11-05 18:29:31 +03:00
Carlos Antonio da Silva
b1fe78e0cb
Raise ArgumentError when no attribute is given to AMo::EachValidator
...
ArgumentError is better suited than RuntimeError for this.
2012-11-04 11:41:05 -02:00
Carlos Antonio da Silva
d9f20c575a
Set hash value instead of using merge!
2012-11-04 11:35:01 -02:00
Vijay Dev
3b0bb08699
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
actionpack/lib/action_controller/metal/mime_responds.rb
activerecord/lib/active_record/attribute_methods.rb
guides/source/working_with_javascript_in_rails.md
2012-11-03 01:56:16 +05:30
Alexey Gaziev
b955939d55
Make caller attribute in deprecation methods optional
2012-10-30 10:23:41 +08:00
Nikita Afanasenko
0b7067d849
Provide a call stack for deprecation warnings where needed.
...
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.
2012-10-29 19:22:59 +04:00
Francesco Rodriguez
10d9cb2052
fix AM::Serializers titles [ci skip]
2012-10-26 21:46:15 -05:00
Francesco Rodriguez
070329596f
AM::Serializers::Xml depends on AM::Naming
2012-10-26 21:45:40 -05:00
Francesco Rodriguez
9ac095fef5
minor edits and remove mixed titles in AM::Validations docs [ci skip]
2012-10-25 20:41:35 -05:00
Francesco Rodriguez
2ef4d5ed5c
fix output messages - docs [ci skip]
2012-10-22 14:27:55 -05:00
AvnerCohen
77eb1fb22d
convert comments to 1.9 hash syntax
2012-10-22 19:34:24 +02:00
Vijay Dev
f938019da2
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
activesupport/lib/active_support/core_ext/hash/slice.rb
guides/source/active_support_core_extensions.md
2012-10-21 18:49:19 +05:30
Francesco Rodriguez
c9a88a2c26
minor edits in AM documentation [ci skip]
2012-10-21 01:26:01 -05:00
Francesco Rodriguez
f12244b6d7
remove non-breaking spaces [ci skip]
2012-10-18 01:23:26 -05:00
Yves Senn
a06012c81f
active_model/validations requires necessary files to run
2012-10-18 07:44:41 +02:00
Yves Senn
f00b33e173
cleanup, replace non-breaking spaces with spaces
2012-10-18 07:44:41 +02:00
Rafael Mendonça França
d56b5dacb1
Use the flat_map
method.
...
Thanks to @jeremy to teach me this one.
2012-10-03 00:17:10 -03:00
Rafael Mendonça França
86062005a7
Revert "Merge pull request #7826 from sikachu/master-validators-kind"
...
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.
2012-10-02 23:57:00 -03:00
Rafael Mendonça França
454d820bf0
Don't use tap in this case.
...
The use of tap in this case is very confusing since we are mutating the
return value inside the block
2012-10-02 23:24:42 -03:00
Prem Sichanugrist
4f9b59dba0
Make .validators_on
accept :kind
option
...
This will filter out the validators on a particular attribute based on
its kind.
2012-10-02 22:09:06 -04:00
John Foley
60c65ca8df
Switch to using include? on validation callbacks
2012-09-23 12:53:50 -06:00
John Foley
d66d6076b2
Fix collisions with before and after validation callbacks.
...
This commit allows a user to do something like:
before_validation :do_stuff, :on => [ :create, :update ]
after_validation :do_more, :on => [ :create, :update ]
2012-09-23 12:53:50 -06:00
Francesco Rodriguez
356eed9c60
add :nodoc: to AMo::DeprecatedMassAssignmentSecurity::ClassMethods [ci skip]
2012-09-20 12:18:59 -05:00
Francesco Rodriguez
6783c3f449
change AMo::ForbiddenAttributesProtection#sanitize_for_mass_assignment to protected
2012-09-20 12:18:59 -05:00
Francesco Rodriguez
1e56f1f14c
update AMo::ForbiddenAttributesError documentation [ci skip]
2012-09-20 12:18:59 -05:00
Francesco Rodriguez
3759e32882
add :nodoc: directives to AMo::DeprecatedMassAssignmentSecurity [ci skip]
2012-09-20 12:18:58 -05:00
Guillermo Iguaran
9bfa13bb06
attr_accessible and attr_protected raise an exception pointing to use plugin or new protection model
2012-09-16 23:58:21 -05:00
Guillermo Iguaran
1fa4f9243d
Rename ForbiddenAttributes exception to ForbiddenAttributesError
2012-09-16 23:58:21 -05:00
Guillermo Iguaran
f8c9a4d3e8
Remove MassAssignmentSecurity from ActiveModel
...
This will be moved out to protected_attributes gem
2012-09-16 23:58:19 -05:00
Guillermo Iguaran
a8f6d5c645
Integrate ActiveModel::ForbiddenAttributesProtection from StrongParameters gem
2012-09-16 23:58:19 -05:00
Nihad Abbasov
ab14392cbb
remove '.rb' from require call
2012-09-12 12:48:17 +06:00
Anatoly Makarevich
fce0d088a5
Added forgotten :message option to ActiveModel validates documentation
2012-09-07 14:56:23 +04:00
Gabriel Sobrinho
2f3eb484f2
Accept a symbol for :in
option on inclusion and exclusion validators
2012-08-24 15:26:17 -03:00
José Valim
2801786e1a
Get rid of config.preload_frameworks in favor of config.eager_load_namespaces
...
The new option allows any Ruby namespace to be registered and set
up for eager load. We are effectively exposing the structure existing
in Rails since v3.0 for all developers in order to make their applications
thread-safe and CoW friendly.
2012-08-21 14:47:19 -03:00
Rafael Mendonça França
cfd7f4e9a0
Merge pull request #7024 from bogdan/strict_validation_custom_exception
...
AM::Validation#validates: custom exception for :strict option
Conflicts:
activemodel/CHANGELOG.md
2012-08-16 16:59:04 -03:00
Vijay Dev
176f0888d8
Merge branch 'master' of github.com:lifo/docrails
2012-08-16 00:07:17 +05:30