Brian Cardarella
a8365ab9ad
Declaring the attr_accessor for password_confirmation is not necessary
...
as the confirmation validation already adds that attr_accessor
2011-04-14 16:43:51 +08:00
Prem Sichanugrist
733bfa63f5
Remove #among?
from Active Support
...
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.
It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
2011-04-13 20:25:28 +08:00
Xavier Noria
3366479a9a
Merge branch 'master' of git://github.com/lifo/docrails
2011-04-12 22:45:33 +02:00
David Heinemeier Hansson
d1575ae1b9
Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion!
2011-04-12 00:23:07 +02:00
Oge Nnadi
a43abfafd2
Rewording
2011-04-11 12:54:46 -07:00
José Valim
7379114c2f
Remove code duplication.
2011-04-11 18:01:10 +02:00
José Valim
df5691aa94
No need to rescue here. Invoking the wrong method in an object can happen anywhere if you are not careful. In other words, test your shit.
2011-04-11 17:47:59 +02:00
José Valim
5bf3d46bec
Revert "Add :use_include option to allow user to explicitly use Range#include?
method in Ruby 1.9"
...
Use :with => range.to_a instead.
This reverts commit f6540211b5b9133c9f93c11655a04d613c237e67.
2011-04-11 17:41:33 +02:00
Prem Sichanugrist
a9f3c9da01
Using Object#in? and Object#either? in various places
...
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
2011-04-11 03:17:09 +08:00
Prem Sichanugrist
f6540211b5
Add :use_include option to allow user to explicitly use Range#include?
method in Ruby 1.9
...
In Ruby 1.9 we're currently use `Range#cover?` to fix the performance problem. However, there might be the case that you want to use `Range#include?` instead. This patch will give you that option.
2011-04-10 18:49:28 +08:00
Prem Sichanugrist
58594be680
Add support for proc or lambda as an option for InclusionValidator, ExclusionValidator, and FormatValidator
...
You can now use a proc or lambda in :in option for InclusionValidator and ExclusionValidator, and :with, :without option for FormatValidator
2011-04-10 18:49:28 +08:00
John Firebaugh
d907f3cb5c
Rename test directory to match code directory
...
Hopefully "serializeration" is not an in joke that I missed.
2011-04-06 01:50:35 +08:00
Xavier Noria
3e24e9ebc2
Merge branch 'master' of git://github.com/lifo/docrails
2011-04-03 22:22:03 +02:00
Santiago Pastorino
99da42c299
Gem::Specification#has_rdoc= is deprecated since rubygems 1.7.0
2011-04-02 00:35:33 -03:00
Santiago Pastorino
4f90b28e06
Bring back AMo#i18n_key method
2011-03-30 16:29:43 -03:00
John Firebaugh
b671e4d86a
Fix formatting and broken markup
2011-03-28 22:31:05 -07:00
Santiago Pastorino
450f7cf01b
use class_eval with a string when it's possible
2011-03-22 20:11:36 -03:00
Santiago Pastorino
da6c7bd4b4
Do not in place modify what table_name returns
2011-03-22 19:36:16 -03:00
Santiago Pastorino
445241d713
define_attr_method should be able to define methods that returns nil
2011-03-17 23:17:20 -03:00
Aaron Patterson
4532b39f5f
remove misleading comment
2011-03-17 10:31:12 -07:00
Aaron Patterson
00f0879367
dup strings on return so that in place modifications do not break anything. I am looking at you "compute_table_name"
2011-03-17 10:26:11 -07:00
Santiago Pastorino
c834a751d2
define_attr_method correctly defines methods with invalid identifiers
2011-03-16 21:20:44 -03:00
Santiago Pastorino
fda45f4fc4
Add a define_attr_method test
2011-03-16 21:08:02 -03:00
Santiago Pastorino
5232077517
Add test for define_attr_method using as name an invalid identifier
2011-03-16 21:01:49 -03:00
Santiago Pastorino
cb44e99de4
Add test for define_attribute_method using as name an invalid identifier
2011-03-16 21:01:04 -03:00
Andrew White
e8458d37c5
Fix typo in assertion message
2011-03-16 10:28:40 +00:00
Norman Clarke
7bd70dcd6c
Add messages to plain assertions.
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-15 10:44:14 -03:00
Santiago Pastorino
157c37f558
Refactor length validation
2011-03-12 21:12:44 -02:00
Andriy Tyurnikov
f48d3d4df6
length validation for fixnums
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-12 21:12:44 -02:00
Mike Gehard
58de03f077
Add additional text to NotImplementedErrors [ #6328 state:resolved]
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-12 13:43:23 -02:00
Xavier Noria
89ecc0a5dc
Merge branch 'master' of git://github.com/lifo/docrails
2011-03-07 22:11:47 +01:00
Vijay Dev
f99db5a6a8
formatting changes
2011-03-07 23:56:16 +05:30
Paco Guzman
8e0affbd86
Configuration options are symbols
2011-03-06 22:35:26 +01:00
Paco Guzman
14c254aba3
Remove Example headers. Code just flows with the text. 6ce844a3
2011-03-06 22:34:01 +01:00
Paco Guzman
7e9d45cc7f
remove unused assigned variable
2011-03-06 22:24:22 +01:00
R.T. Lechow
86c15d8b89
Active Model typos.
2011-03-05 11:56:34 +01:00
Alexander Uvarov
24faddd60c
Move ActiveModel::AttributeMethods#attribute_methods_generated? to ActiveRecord, so it's flexible now
...
[#6428 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-03-01 20:22:45 +01:00
Santiago Pastorino
a00bed0c48
Revert "Properly interpolate i18n keys in modules [ #5572 state:resolved]"
...
This breaks #6448 , you should use :"module/class" as key for namespacing
[#6448 state:committed]
This reverts commit 8d30193b08bd2321a7a78a1f481bd5e4d4d45557.
2011-02-27 21:30:03 -02:00
Santiago Pastorino
acf0688fdd
failing test for i18n key collision with namespaced models
2011-02-27 21:23:52 -02:00
Prem Sichanugrist
839d06f5f2
We're in 2011, let's update our license
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-22 18:24:20 -02:00
Xavier Noria
f826e05835
Merge branch 'master' of git://github.com/lifo/docrails
2011-02-21 11:42:26 +01:00
Xavier Noria
b481574a33
copy-edits 8d96b89
2011-02-21 11:37:08 +01:00
Xavier Noria
9297027e08
copy-edits 6d7a826
2011-02-21 11:01:26 +01:00
Xavier Noria
843a5b9a3a
copy-edits 34316d8
2011-02-21 11:00:03 +01:00
Nicholas Rowe
34316d8b7e
Docs: Update to_xml documentation to match as_json docuemntation
2011-02-20 21:35:43 -05:00
Nicholas Rowe
6d7a8267b9
Documentation: Added small comments to Observering module
2011-02-20 21:05:41 -05:00
Xavier Noria
e2d54fb3f1
documents the backported Range#cover?, and related stuff
2011-02-20 10:52:49 +01:00
Diego Carrion
511bf2a050
refactored ActiveModel::Validations::InclusionValidator#validate_each
...
[#6455 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-19 23:24:38 -02:00
Peer Allan
8d96b89110
Clarification of ActiveRecord ActiveModel validation documentation
2011-02-18 20:51:56 -06:00
Xavier Noria
f41bf6938f
merges docrails
2011-02-18 23:22:15 +01:00
Frederick Cheung
fbfa30a1ee
Change validates inclusion to use cover? for Ranges in ruby 1.9 [ #6453 state:committed]
...
Signed-off-by: Xavier Noria <fxn@hashref.com>
2011-02-18 21:32:28 +01:00
Nicholas Rowe
a906deabc6
fix type: remove extra period
2011-02-17 20:34:22 -05:00
Jimmy Cuadra
bd7d8665a0
add note about observer config for rails apps
...
ActiveModel::Observer and ActiveRecord::Observer have similar
documentation, but a Rails user looking at the ActiveModel version
might not realize that a change to config/application.rb is
required to activate the observer. This change adds a note to
that effect, pointing to the AR version from the AM version.
2011-02-16 14:15:48 -08:00
Tsutomu Kuroda
ad31549ab3
Override attributes_protected_by_default when has_secure_password is called.
...
attr_protected should not be called, because it nullifies the
mass assignment protection that has been set by attr_accessible.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-09 18:35:15 -02:00
Aaron Patterson
f48d32c0cf
implementing include? on AM::Errors
2011-02-09 09:19:56 -08:00
Aaron Patterson
51d84c1d33
we do not need message to be an array
2011-02-09 08:42:13 -08:00
Aaron Patterson
c6b4ef082f
use map rather than array concatenation
2011-02-09 08:32:43 -08:00
Aaron Patterson
307e6b2b74
favor composition over inheritence
2011-02-09 08:32:43 -08:00
Aaron Patterson
ed6e09c1b1
use 1 call to concat rather than calling << n times
2011-02-09 08:32:43 -08:00
Santiago Pastorino
933adce8f4
Use map + flatten here
2011-02-07 19:15:06 -02:00
Nathaniel Bibler
285fdbae2b
Fixed broken, memoized attributes method example
...
[#6245 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-07 14:44:37 -02:00
Carl Lerche
cf9324e590
Find all validators for multiple attributes
2011-02-05 20:27:02 -08:00
Carl Lerche
cd13fbd8d8
Optionally pass in the attribute being validated to an instance method validator
2011-02-05 16:44:35 -08:00
Carl Lerche
e9e9ed6b60
Be able to pass a validator method to #validates
2011-02-05 16:33:00 -08:00
Carl Lerche
ed7614aa7d
Provide a way to specify alternate option keys for validates
2011-02-05 16:00:57 -08:00
Carl Lerche
7176ade35b
Do not require that validation attributes be specified as symbols
2011-02-05 15:37:38 -08:00
Santiago Pastorino
082326deb5
module_eval is not needed here
2011-02-03 20:47:02 -02:00
Santiago Pastorino
6f4d9989dd
method_defined?, define_method and send accepts a string as argument
2011-02-03 20:37:12 -02:00
Caleb Land
bca070ef2d
allow spaces and other characters in attribute names [ #4725 state:resolved]
...
* define the dynamically defined methods with
'define_method' instead of def
* wrap some string injected method names in quotes
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 19:05:17 -02:00
Xavier Noria
a96a9a4948
Merge branch 'master' of git://github.com/lifo/docrails
2011-02-02 22:04:11 +01:00
John Firebaugh
57bc25c5f8
Use run_callbacks; the generated _run_<name>_callbacks method is not a public interface.
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-31 19:45:53 -02:00
Paul Yoder
d8919d3151
Deleted extra "a" in method comment
2011-01-27 09:27:35 -06:00
Aaron Patterson
b5cc277763
psych does not emit a space after the tag
2011-01-21 15:13:30 -08:00
Xavier Noria
236f1f52cd
Merge branch 'master' of git://github.com/lifo/docrails
2011-01-20 10:33:38 +01:00
Daniel Schierbeck
1a051259b4
Properly indent code example block
2011-01-15 17:54:02 +01:00
brainopia
da82b0a746
Remove reference to ActiveRecord from ActiveModel comments
2011-01-15 03:10:10 +03:00
Santiago Pastorino
9a57a2279e
sorry, the CI cannot lie to us anymore (Part II)
2011-01-13 10:55:41 -02:00
Santiago Pastorino
2b2b50660b
Bump up bcrypt-ruby dependency to 2.1.4
2011-01-09 19:04:43 -02:00
Hemant Kumar
8de5595e4d
fix difference between behaviour of blank and empty
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-01-05 13:18:10 +01:00
Xavier Noria
99424eb099
Revert "Update CHANGELOGs to include 3.0.3 changes"
...
Reason: Sorry, CHANGELOGs can only be edited in master.
If you provide a patch I'll apply it myself. Thanks!
This reverts commit 1f8ecb85d7c1b3efdf45c3cf3461502b608c1a7c.
2011-01-02 00:20:59 +01:00
Prem Sichanugrist
1f8ecb85d7
Update CHANGELOGs to include 3.0.3 changes
2011-01-02 03:35:38 +07:00
David Heinemeier Hansson
43433b3fb4
Instance methods shouldnt be added until you actually call has_secure_password
2010-12-29 10:18:14 -08:00
José Valim
6b099975fa
No need to symbolize these.
2010-12-27 09:30:36 +01:00
Aaron Patterson
207f266cca
define_attr_method must serialize nil correctly
2010-12-20 19:47:15 -08:00
Xavier Noria
880f8419c4
Merge branch 'master' of git://github.com/lifo/docrails
2010-12-20 20:13:34 +01:00
Santiago Pastorino
ab2bde45f8
Remove require AS::Concern from places where is already in
2010-12-19 19:15:26 -02:00
Santiago Pastorino
5fb42ac478
Tests and docs which explain the use of validate with a block and without arguments
2010-12-19 18:50:18 -02:00
Vijay Dev
4038a6bc0f
minor fixesin READMEs
2010-12-20 01:07:33 +05:30
Santiago Pastorino
08ccd29b5b
Remove weak_passwords list and the length/strong password validator, leave that up to the programmer
2010-12-19 15:01:29 -02:00
José Valim
6d80f3a1ba
Use class_attribute to ensure weak_passwords are inheritable.
2010-12-19 13:31:48 +01:00
Mikel Lindsaar
6c217f98db
Add set_weak_passwords call in alignment with set_table_name.
2010-12-19 21:36:47 +11:00
Mikel Lindsaar
fa14df08a8
Fix incorrect docs
2010-12-19 20:54:15 +11:00
Mikel Lindsaar
a39a333769
Added ability to specify which passwords you want as weak passwords
2010-12-19 20:39:54 +11:00
José Valim
863de37b05
'unsecure' => 'insecure'
2010-12-19 09:37:08 +01:00
José Valim
432556b923
Make password messages translatable.
2010-12-19 09:34:31 +01:00
José Valim
b8f6dd8cbb
Add missing require and remove extra module.
2010-12-19 09:31:26 +01:00
José Valim
d592fa946d
Avoid warnings and fix small typo on SecurePassword.
2010-12-19 09:28:15 +01:00
David Heinemeier Hansson
bd9dc4ff23
BCrypt does its own salting, lovely!
2010-12-18 19:09:07 -08:00
David Heinemeier Hansson
39b5ea6e01
Switch from SHA2 to BCrypt (easy Windows compatibility is coming shortly with new compiled gem)
2010-12-18 15:39:32 -08:00
David Heinemeier Hansson
bcf4e4f2b0
Added ActiveRecord::Base#has_secure_password (via ActiveModel::SecurePassword) to encapsulate dead-simple password usage with SHA2 encryption and salting
2010-12-18 13:38:05 -08:00