Commit Graph

401 Commits

Author SHA1 Message Date
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
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
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
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
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
Akira Matsuda
a3fbbb626f 'nil' => nil 2010-12-17 14:37:22 +09:00
Samuel Kadolph
972011a2e5 Add support for namespaced validators
Includes test and documentation for new feature

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-16 01:49:28 +05:30
Samuel Kadolph
2650742bd0 Add support for namespaced validators
Includes test and documentation for new feature

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-11 16:35:18 -02:00
Xavier Noria
c6612d2bb3 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	activerecord/lib/active_record/transactions.rb
2010-12-11 00:55:25 +01:00
Ryan Bigg
b4ec6f0d39 Move ActiveModel::Lint::Tests documentation to be above module declaration so it appears in the API docs for this module. 2010-12-09 18:16:18 +10:00
Mike Dvorkin
f572a02b94 Take into account current time zone when serializing datetime values [#6096 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-09 09:01:49 +01:00
Santiago Pastorino
33b0a30fcc default could be a symbol here so attribute.to_s.humanize should be the final option 2010-12-05 12:57:45 -02:00
Santiago Pastorino
3ab98cf6e0 If default is provided don't add attribute.to_s.humanize to the options 2010-12-05 12:36:56 -02:00
Xavier Noria
48386d245b Merge branch 'master' of git://github.com/lifo/docrails 2010-12-05 10:33:50 +01:00