Francesco Rodriguez
f87820d00a
update ActiveModel::Dirty documentation
2012-05-31 05:06:00 -05:00
José Valim
555d8152c7
Merge pull request #5843 from kuroda/translation_of_deeply_nested_model_attributes
...
Fix human attribute_name to handle deeply nested attributes
2012-05-29 23:26:26 -07:00
Steve Purcell
b3ccd7b27a
Don't enable validations when passing false hash values to ActiveModel.validates
...
Passing a falsey option value for a validator currently causes that validator to
be enabled, just like "true":
ActiveModel.validates :foo, :presence => false
This is rather counterintuitive, and makes it inconvenient to wrap `validates` in
methods which may conditionally enable different validators.
As an example, one is currently forced to write:
def has_slug(source_field, options={:unique => true})
slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? }
before_validation slugger
validations = { :presence => true, :slug => true }
if options[:unique]
validations[:uniqueness] = true
end
validates :slug, validations
end
because the following reasonable-looking alternative fails to work as expected:
def has_slug(source_field, options={:unique => true})
slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? }
before_validation slugger
validates :slug, :presence => true, :slug => true, :uniqueness => options[:unique]
end
(This commit includes a test, and all activemodel and activerecord tests pass as before.)
2012-05-28 15:02:02 +01:00
Vijay Dev
575e77ba16
Merge branch 'master' of github.com:lifo/docrails
2012-05-26 17:49:59 +05:30
Edward Tsech
b98a343da5
Add comment for attr_accessible/attr_protected :as option. [ci skip]
2012-05-25 16:35:53 +02:00
José Valim
56417b4092
Merge pull request #4785 from ayamomiji/add-self-to-allow-method-name-using-ruby-keyword
...
add `self.` to allow method name using ruby keyword
2012-05-25 00:29:07 -07:00
Angelo capilleri
5646d65d01
changed xml type datetime to dateTime, fixes #6328
...
XmlMini define the xml 'datatime', but according to
http://www.w3.org/TR/xmlschema-2/#dateTime could be better
change this to 'dateTime' with upper case letter 'T.
So 'DateTime' and 'Time' are redefined from 'datetime' to 'dateTime'
add the changing to the changelog
2012-05-23 14:45:56 +02:00
Santiago Pastorino
344ea04865
Fix the build
2012-05-22 12:10:35 -03:00
Santiago Pastorino
38293ea828
require active_support/lazy_load_hooks where is needed
2012-05-22 11:33:03 -03:00
Piotr Sarnacki
08a5b10eb1
Revert "Merge pull request #5702 from oscardelben/patch-4"
...
This reverts commit cae1ca7d1be9c79c7ef012a1f62aef9d3bb815f8, reversing
changes made to da97cf016a8ffd1f54f804cd881f393e5d6efc18.
These changes break the build, it needs more investigation.
2012-05-20 11:11:20 -07:00
Piotr Sarnacki
cae1ca7d1b
Merge pull request #5702 from oscardelben/patch-4
...
Call undefine_attribute_methods only when defining new attributes
2012-05-19 23:57:58 -07:00
Carlos Antonio da Silva
f20032fa15
Merge pull request #5678 from troyk/patch-1
...
Remove sort on attributes.keys
2012-05-19 06:08:33 -07:00
Oscar Del Ben
42d0b1c8dd
Call undefine_attribute_methods only when defining new attributes
2012-05-18 08:50:57 -07:00
Aaron Patterson
1b604c73f1
Merge pull request #6215 from erichmenge/fix_has_secure_password
...
Fix has secure password
2012-05-17 10:32:15 -07:00
Vijay Dev
03f8a57487
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
activerecord/lib/active_record/core.rb
2012-05-17 17:49:33 +05:30
Naoto Takai
80a2c9e5db
Improve logging of ActiveModel::MassAssignmentSecurity::Sanitizer
2012-05-17 06:55:41 +09:00
Francesco Rodriguez
3004bc2470
fixing removed empty lines and examples
2012-05-16 10:01:43 -05:00
Francesco Rodriguez
a9e66c62e9
fixing validates_with docs
2012-05-16 08:56:31 -05:00
Francesco Rodriguez
95e14d1523
better format and fixes to validators docs
2012-05-16 01:23:46 -05:00
Francesco Rodriguez
007c3d8bcb
better example format in validates_exclusion_of docs
2012-05-16 00:06:44 -05:00
Tsutomu Kuroda
b0e2fc843b
Fix human attribute_name to handle deeply nested attributes
...
When a model nests another model that also nests yet another model
using accepts_nested_attributes_for method, its Errors object can
have an attribute name with "contacts.addresses.street" style.
In this case, the dots within the namespace should be substituted
with slashes so that we can provide the translation under the
"activemodel.attributes.person/contacts/addresses.street" key.
This commit is related to #3859 .
2012-05-16 08:39:48 +09:00
Carlos Antonio da Silva
9b4f5041d2
Kill whitespaces ✂️
2012-05-15 13:38:29 -03:00
Carlos Antonio da Silva
3d1b078a5b
Merge pull request #6284 from acapilleri/dup_validation
...
clean the erros if an object that includes validation is duped.
2012-05-15 05:20:57 -07:00
Vijay Dev
59b03d418f
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
actionpack/lib/action_view/helpers/asset_tag_helper.rb
2012-05-15 13:13:55 +05:30
Francesco Rodriguez
00c94d7d94
updating define_attribute_methods documentation
2012-05-14 11:38:23 -05:00
Francesco Rodriguez
05234b358f
allow define_attribute_methods to pass multiple values
2012-05-14 11:35:15 -05:00
Alexey Vakhov
7a95d079a3
Missed colon
2012-05-14 09:13:59 +04:00
Angelo Capilleri
f9ae1baa0a
clean the erros if an object that includes validations errors is duped. Fixes #5953
2012-05-13 23:24:05 +02:00
ayaya
c140a27fc5
fix alias_attribute
will raise a syntax error if make an alias on a
...
column that named as a ruby keyword
2012-05-14 00:57:29 +08:00
José Valim
7d67880a2d
Merge pull request #5729 from oscardelben/use_tap
...
Use the more idiomatic tap method
2012-05-13 01:00:17 -07:00
Santiago Pastorino
36dd1857dc
Remove useless load path modifications
2012-05-11 19:00:35 -03:00
Santiago Pastorino
a00228c1a3
Lazy load I18n
2012-05-11 19:00:25 -03:00
Jon Leighton
a8637cf493
Use respond_to?(:to_ary) rather than is_a?(Enumerable) to detect collection-thing.
2012-05-11 20:11:04 +01:00
Erich Menge
0e1e527654
has_secure_password shouldn't validate password_digest. It should also take options to turn validations off.
2012-05-08 18:08:55 -05:00
Vijay Dev
7e26f7f0f7
simplify the alias_attribute example [ci skip]
2012-05-08 23:54:47 +05:30
Francesco Rodriguez
4831a895c4
added docs to alias_attribute method
2012-05-07 22:47:35 -05:00
Vijay Dev
42ff22f33a
Merge branch 'master' of github.com:lifo/docrails
2012-05-01 19:06:03 +05:30
Edward Tsech
6e8f2be51a
Add line which gives a little bit more information how *_will_change! works.
2012-05-01 13:52:21 +02:00
Marc-Andre Lafortune
dc74f0cb1b
notify_observers should be public
2012-04-30 22:13:26 -04:00
Aaron Patterson
206b43a954
Merge pull request #6063 from marcandre/observer_extra_args
...
Allow extra arguments for Observers
2012-04-30 16:43:22 -07:00
Marc-Andre Lafortune
24c068d67d
Allow extra arguments for Observers
2012-04-30 18:10:03 -04:00
Jeremy Kemper
0393c7cd51
Merge pull request #6071 from marcandre/observer_redef
...
Fix Observer by acting on singleton class. Fixes #3505 .
2012-04-29 21:10:15 -07:00
Marc-Andre Lafortune
bad44e4f8f
Fix Observer by acting on singleton class [ #3505 ]
...
Also [issue #1034 ] [pull #6068 ]
2012-04-29 21:51:50 -04:00
Aaron Patterson
f975a8663e
Merge pull request #5942 from bcardarella/confirmation_error_message_on_confirmation_attribute
...
confirmation validation error attribute
2012-04-29 16:29:33 -07:00
Marc-Andre Lafortune
569fb1fffb
Generate appropriate error more judiciously
2012-04-29 00:51:56 -04:00
Marc-Andre Lafortune
85c056cc1f
Fix error message:
...
- can pass the class, not the instance
- "instance method" is confusing, use "method :instance" instead
2012-04-28 23:20:42 -04:00
Carlos Antonio da Silva
f48d83b599
Refactor human attribute name
2012-04-28 12:14:59 -03:00
Carlos Antonio da Silva
cafe6a38f5
Do not modify options hash in human_attribute_name, remove reverse_merge
2012-04-28 11:23:29 -03:00
José Valim
fc6b115b88
Merge pull request #6025 from carlosantoniodasilva/amo-errors-refactor
...
Refactor AMo::Errors
2012-04-28 00:17:18 -07:00
Carlos Antonio da Silva
709b748f09
Refactor AMo::Errors
...
* Use merge!, remove reverse_merge
* Use case statement instead of is_a? checks
2012-04-27 21:04:13 -03:00