Commit Graph

911 Commits

Author SHA1 Message Date
Guillermo Iguaran
6779064437 Remove hard dependency on bcrypt. 2011-09-02 10:01:47 -07:00
Josh Nesbitt
d0f9f4e664 Fix typo in ActiveModel::Dirty comment. define_attribute_methods is a class method, not attribute. 2011-09-02 13:28:38 +01:00
José Valim
d15069316f Merge pull request #2563 from bogdan/internal_validation
Implemented strict validation concept
2011-08-25 07:10:16 -07:00
Bogdan Gusiev
cbb147931b Typo fix 2011-08-25 16:43:43 +03:00
Aaron Patterson
09e2109686 bumping bcrypt-ruby requirement 2011-08-24 13:26:38 -07:00
Bogdan Gusiev
afe04da10b Add change log entry on strict validation 2011-08-24 10:26:18 +03:00
Xavier Noria
45f8ca54c9 Merge pull request #2653 from luckydev/ser-wrap
Missing require array/wrap in serialization
2011-08-23 04:05:34 -07:00
Anand
1be3442a0a added missing require array/wrap in serialization 2011-08-23 16:30:02 +05:30
Anand
56e32ad40f added more tests for only-include and except-include options in serialization 2011-08-23 16:03:58 +05:30
Bogdan Gusiev
8620bf90c5 Implemented strict validation concept
In order to deliver debug information to dev team
instead of display error message to end user
Implemented strict validation concept
that suppose to define validation that always raise exception when fails
2011-08-17 17:26:00 +03:00
Xavier Noria
0245792c83 Merge branch 'master' of github.com:lifo/docrails 2011-08-16 11:06:40 -07:00
Vijay Dev
b98d3ab6f5 fix misleading comment (originally made by Tate Johnson, we lost this commit while porting to the rails repo) 2011-08-14 19:29:35 +05:30
Xavier Noria
bf2b9d2de3 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	RELEASING_RAILS.rdoc
	actionpack/lib/sprockets/railtie.rb
	actionpack/test/template/sprockets_helper_test.rb
	activerecord/test/cases/calculations_test.rb
	railties/guides/source/3_1_release_notes.textile
	railties/guides/source/active_resource_basics.textile
	railties/guides/source/command_line.textile
2011-08-13 16:30:07 -07:00
Tate Johnson
239e615316 Fixed typo 2011-08-13 16:22:33 -07:00
Waynn Lue
2579d88405 capitalize RubyGems properl 2011-08-13 16:22:31 -07:00
Bogdan Gusiev
f86f770250 MassAssignmentProtection: consider 'id' insensetive in StrictSanitizer
In order to use StrictSanitizer in test mode
Consider :id as not sensetive attribute that can be filtered from
mass assignement without exception.
2011-08-13 16:22:26 -07:00
José Valim
b6b6e81a5c Rename new method to_path to to_partial_path to avoid conflicts with File#to_path and similar. 2011-08-13 16:22:26 -07:00
Grant Hutchins
c4cf9073a1 Give attribution to Peter Jaros for the patch we paired on. 2011-08-13 16:22:23 -07:00
José Valim
66fdfbc2d5 Update CHANGELOG. 2011-08-13 16:22:21 -07:00
José Valim
91ca214ca0 Rename class method to_path to _to_path and make it explicit that it is an internal method. 2011-08-13 16:22:21 -07:00
Grant Hutchins & Peter Jaros
6e671a8536 Let ActiveModel instances define partial paths.
Deprecate ActiveModel::Name#partial_path. Now you
should call #to_path directly on ActiveModel
instances.
2011-08-13 16:22:21 -07:00
thedarkone
45f9c2b361 Handle the empty array correctly. 2011-08-13 16:22:20 -07:00
Rashmi Yadav
111347f0cc The trailing '/' isn't being picked up by Github anyway, and the link works as is. 2011-08-13 16:22:15 -07:00
Myron Marston
d3c15a1d31 Allow ActiveRecord observers to be disabled.
We have to use Observer#update rather than Observer#send since the enabled state is checked in #update before forwarding the method call on.
2011-08-12 20:48:44 -07:00
Rashmi Yadav
681d919e48 The trailing '/' isn't being picked up by Github anyway, and the link works as is. 2011-08-04 16:41:31 -07:00
José Valim
6b3af028ac Merge pull request #2385 from bogdan/test_default_sanitizer2
MassAssignmentProtection: consider 'id' insensetive in StrictSanitizer
2011-08-01 04:50:06 -07:00
José Valim
dc8773b19f Rename new method to_path to to_partial_path to avoid conflicts with File#to_path and similar. 2011-08-01 11:42:00 +02:00
Franck Verrot
325fdfc928 Remove warnings by calling remove_method 2011-07-31 20:05:58 +02:00
Grant Hutchins
b407034c9d Give attribution to Peter Jaros for the patch we paired on. 2011-07-28 13:38:28 -03:00
Bogdan Gusiev
b93a918337 MassAssignmentProtection: consider 'id' insensetive in StrictSanitizer
In order to use StrictSanitizer in test mode
Consider :id as not sensetive attribute that can be filtered from
mass assignement without exception.
2011-07-28 11:56:08 +03:00
José Valim
30dae273c8 Update CHANGELOG. 2011-07-28 10:05:17 +02:00
José Valim
dee8115539 Rename class method to_path to _to_path and make it explicit that it is an internal method. 2011-07-28 09:56:42 +02:00
José Valim
1b7db58a06 Merge pull request #2034 from Casecommons/to_path
Allow ActiveModel-compatible instances to define their own partial paths
2011-07-28 00:50:07 -07:00
Santiago Pastorino
fa2bfd832c Merge pull request #2305 from thedarkone/errors-include
Improve AM::Errors#include?
2011-07-27 09:44:15 -07:00
thedarkone
efe4cbe5f2 Handle the empty array correctly. 2011-07-27 18:07:47 +02:00
Grant Hutchins & Peter Jaros
bf812074fd Let ActiveModel instances define partial paths.
Deprecate ActiveModel::Name#partial_path. Now you
should call #to_path directly on ActiveModel
instances.
2011-07-25 16:05:24 -04:00
Ben Marini
c02288e6fd Fix example code for #validates_with instance method 2011-07-24 12:13:23 -07:00
Xavier Noria
ace3723d2f Merge branch 'master' of git://github.com/lifo/docrails 2011-07-23 12:15:41 +02:00
Vishnu Atrai
5801f42975 fixed type 2011-07-21 10:12:29 -07:00
Bratish Goswami
840ca47a46 Download and installation, License and Support sections added for activemodel 2011-07-21 13:03:45 +05:30
Sebastian Gassner
9714d866f5 Documentation fix: adding missing equal sign in code sample for ActiveModel::Dirty. 2011-07-20 10:31:57 +02:00
José Valim
da144894e9 Merge pull request #195 from bigfix/active_model_include_serialization
ActiveModel support for the :include serialization option
2011-07-18 06:50:43 -07:00
John Firebaugh
4860143ee4 ActiveModel support for the :include serialization option
This commit moves support for the :include serialization option for
serializing associated objects out of ActiveRecord in into ActiveModel.
The following methods support the :include option:

  * serializable_hash
  * to_json
  * to_xml

Instances must respond to methods named by the values of the :includes
array (or keys of the :includes hash). If an association method returns
an object that is_a?(Enumerable) (which AR has_many associations do), it
is assumed to be a collection association, and its elements must respond
to :serializable_hash. Otherwise it must respond to :serializable_hash
itself.

While here, fix #858, XmlSerializer should not singularize already
singular association names.
2011-07-17 11:34:07 -07:00
John Firebaugh
cbf924ef08 Replace map+compact with select 2011-07-17 11:34:06 -07:00
John Firebaugh
2a9a10f5e3 Add a test 2011-07-17 11:34:06 -07:00
John Firebaugh
da4e1faf6f serializable_hash(:only => [], :methods => [:foo]) should work 2011-07-17 11:34:06 -07:00
Lawrence Pit
52a096275a Made attribute_method_matchers_cache private + doc 2011-07-17 14:51:34 +10:00
Lawrence Pit
c3dd4c653d Issue #2075 Optimization of ActiveModel's match_attribute_method? 2011-07-16 16:40:11 +10:00
Lawrence Pit
f04c5d640d Optimization of ActiveModel's match_attribute_method? 2011-07-15 09:58:46 +10:00
Joe Fiorini
ac5e691153 Enable passing root: false to #to_json 2011-07-01 23:00:13 -04:00
Santiago Pastorino
35cdd256c0 Master version is 3.2.0.beta 2011-06-30 10:18:36 -03:00
Ian Stewart
eafa174bfd changing an attribute multiple times retains the correct original value 2011-06-28 22:18:24 -07:00
Alexander Uvarov
e945497955 Minor formating fix 2011-06-24 03:52:39 +06:00
Alexander Uvarov
ee044ea547 Follow rails convention by using Array.wrap 2011-06-23 23:06:52 +06:00
Alexander Uvarov
528f405cdc Allow to specify mass-assignment roles as array 2011-06-23 12:56:39 +06:00
Xavier Noria
146ec2d1df Merge branch 'master' of git://github.com/lifo/docrails 2011-06-18 10:11:47 +02:00
Santiago Pastorino
5599e3fa0c Merge pull request #1654 from ganeshkumar/test_cases
removed duplicate code in tests
2011-06-13 05:45:47 -07:00
Guillermo Iguaran
657ba2a9f0 Remove trailing whitespaces 2011-06-12 10:31:21 -05:00
ganesh
7c3094626d removed duplicate code 2011-06-11 21:49:12 +05:30
José Valim
82568bedae Update CHANGELOG. 2011-06-11 18:03:13 +02:00
José Valim
410a42860b Get rid of the alternate namespace lookup. 2011-06-11 18:01:26 +02:00
thoefer
0831b7e076 Brought back alternative convention for namespaced models in i18n. 2011-06-08 13:40:17 +02:00
Xavier Noria
5e21247131 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	activerecord/RUNNING_UNIT_TESTS
2011-06-06 22:23:30 +02:00
Vijay Dev
82aedbb96d fix incorrect output 2011-06-04 20:12:25 +05:30
Vijay Dev
ced2b25036 use clearer variable name in examples 2011-06-04 02:11:43 +05:30
Vijay Dev
caa8ab09f7 remove stray ( 2011-06-03 14:25:13 +05:30
Ben Orenstein
8e071bc068 Change hashrocket spacing to match conventions. 2011-06-02 17:33:48 -04:00
Guillermo Iguaran
698b600719 Don't add .rb in requires 2011-05-31 21:43:04 -05:00
Damien Mathieu
70381cf507 no need for .rb 2011-05-31 23:38:51 +02:00
Damien Mathieu
bb828990bd string inflections are needed for running tests in isolation 2011-05-31 23:38:39 +02:00
José Valim
12786518f1 Update CHANGELOG. 2011-05-31 12:26:32 +02:00
José Valim
139a9f7011 Transform the symbol into a constant lookup. 2011-05-31 12:24:30 +02:00
Bogdan Gusiev
aa2639e746 ActiveModel::MassAssignmentSecurity.mass_assignment_sanitizer method
In order to specify your own sanitize method
Implemented .mass_assignment_sanitizer configuration option
2011-05-30 11:34:00 +03:00
José Valim
0731945e74 Merge pull request #1334 from bogdan/callback
MassAssignmentSecurity: add ability to specify your own sanitizer
2011-05-26 11:47:35 -07:00
Bogdan Gusiev
c7567c9a6d MassAssignmentSecurity: add ability to specify your own sanitizer
Added an ability to specify your own behavior on mass assingment
protection, controlled by option:
ActiveModel::MassAssignmentSecurity.mass_assignment_sanitizer
2011-05-26 15:58:43 +03:00
Xavier Noria
00e1d0832e Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	actionmailer/lib/action_mailer/base.rb
	activesupport/lib/active_support/core_ext/kernel/requires.rb
2011-05-25 22:48:47 +02:00
Vijay Dev
79e9a2983a fixes Rake::GemPackageTask deprecation warnings from rake 0.9.0 2011-05-24 23:39:24 +05:30
Sebastian Martinez
2a4b780ab1 Remove extra white spaces on ActiveModel docs. 2011-05-23 20:39:10 -03:00
Joshua Peek
5e519fb015 Merge branch '3-1-stable'
Conflicts:
	actionpack/actionpack.gemspec
	activemodel/activemodel.gemspec
2011-05-22 20:11:36 -05:00
José Valim
06474c1553 Merge pull request #1192 from arunagw/removal_extra
No more need rubygems here.
2011-05-22 09:12:27 -07:00
José Valim
9164dda151 Fix I18n dependency as final is out. 2011-05-22 13:39:13 +02:00
José Valim
d5646e842f Move I18n dependency back to ActiveSupport. 2011-05-22 13:31:19 +02:00
Daniel Schierbeck
93659a3166 Remove superfluous whitespace from ActiveModel::SecurePassword
Only one space is needed, yo!
2011-05-22 04:02:47 -07:00
David Heinemeier Hansson
82857adc56 Bump versions for rc1 2011-05-21 20:56:52 -05:00
Arun Agrawal
1ffc3063b7 No more need rubygems here. 2011-05-22 02:02:56 +05:30
Xavier Noria
eb0257944e Merge pull request #1180 from Karunakar/documentation_change
Documentation Error Fixed for ticket #839
2011-05-21 10:39:28 -07:00
José Valim
26703f4905 Merge pull request #1165 from arunagw/rubyforge_remove
Not updating rubyforge for new versions.
2011-05-21 04:55:37 -07:00
Ganesh Kumar
3d789ea4b9 ActionMailer deliver method Documentation corrected Ticket #761 2011-05-21 13:55:52 +05:30
Yves Senn
e5429b789d Specify the name to be used for ActiveModel::Name fixes #1168
This patch allows to specify the name of your models independent of the class name.
2011-05-20 16:59:09 +02:00
Arun Agrawal
f72f591c8c Not updating rubyforge for new versions. Result of "gem list -d rails" is not useful. 2011-05-20 17:43:40 +05:30
Guillermo Iguaran
ec1993c33f Prefer each instead of for in 2011-05-19 01:25:31 -05:00
Jim Herzberg
fbf99653f1 Attributes with :string type should not be given the type passed in model serialization options. Closes #1058 2011-05-18 15:52:55 -04:00
Akira Matsuda
35c5ccb30c Remove unneeded merge with default false options 2011-05-16 15:37:44 +09:00
Akira Matsuda
cbe1d2488b Don't add DEFAULT_TOKENIZER to every instance of LengthValidator. Just use it only when needed. 2011-05-16 15:37:44 +09:00
Xavier Noria
d491130236 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	actionpack/lib/action_view/helpers/date_helper.rb
	railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt
2011-05-14 11:21:27 +02:00
Sebastian Martinez
21b61a8ac4 Follow code conventions on some tests 2011-05-10 20:58:36 -03:00
Aaron Patterson
134a05adcb Merge pull request #493 from guilleiguaran/changelog-fixes
Merging 3.0.x CHANGELOGs
2011-05-10 10:04:54 -07:00
Guillermo Iguaran
259c749de1 Merging 3.0.x CHANGELOGs 2011-05-10 11:51:35 -05:00
Joshua Wehner
2cef2d411a Methods that return nil should not be considered YAML 2011-05-10 12:06:09 -04:00
Josh Kalderimis
b2451f4a7f renamed mass-assignment scopes to roles, updated code, tests, docs and security guide 2011-05-08 16:43:29 +02:00
Myron Marston
99363dcf60 Add documentation for new observer enable/disable feature. 2011-05-06 10:00:14 -07:00
José Valim
41a6d96c1b Update CHANGELOGs. 2011-05-06 05:53:58 +02:00
Sebastian Martinez
6826936335 Improve doc styles for ActiveModel::Conversion 2011-05-04 22:49:11 -03:00
David Heinemeier Hansson
169ae75e09 Prepare for beta1 2011-05-04 20:21:05 -05:00
Sebastian Martinez
b84b759ec6 Improved ActiveModel Observing docs. 2011-04-30 20:35:25 -03:00
Dan Pickett
1efaed5af1 Merge branch 'master' of github.com:lifo/docrails 2011-04-29 19:18:10 -04:00
Aditya Sanghi
36ee2bafec fix typo 2011-04-29 09:53:02 +05:30
Aditya Sanghi
bf5cf5db86 :if should not fire on validations when not in context with :on 2011-04-29 02:54:37 +05:30
Myron Marston
7db7aa5053 Add additional tests for AM::ObserverArray that I had missed yesterday. 2011-04-28 08:32:22 -07:00
Myron Marston
fef22157b0 Fix bug with AM::Observer disablement.
Now that we propagate the enabling/disabling to descendants, we no longer have to check the disabled_observer Set on each superclass of the model class.  This was causing a bug when disabling all observers at a superclass level and then enabling an individual observer at a subclass level.

Plus the logic is simpler now :).
2011-04-28 08:27:15 -07:00
Myron Marston
9a385394ac Fix dev env memory leaks by using AS::DescendantsTracker rather than keeping track of subclasses manually.
There's also no need to keep track of all ObserverArray instances in a hash, as this is likely to leak memory, too.
2011-04-28 08:07:08 -07:00
Myron Marston
05d4653cef Revert "Revert "Handle enabling/disabling observers at different levels of the class hierarchy.""
This reverts commit 2a25c5818b03d7d6cd63aad180bff23479dbd861.

I'm going to add another commit that keeps the same behavior of fixes
the problems of leaking memory in development.
2011-04-28 07:58:58 -07:00
José Valim
2a25c5818b Revert "Handle enabling/disabling observers at different levels of the class hierarchy."
This reverts commit ad62f1928768bd2676958a4a08512bad342fe469 because the current
subclasses implementation leaks memory in development.

Instead of keeping an array of subclasses, the better solution is to
ask the parent if an observer is being disabled or not.
2011-04-28 09:32:57 +02:00
Myron Marston
ad62f19287 Handle enabling/disabling observers at different levels of the class hierarchy.
Last call wins.
2011-04-28 10:25:07 +08:00
Myron Marston
1f8cc446d9 Allow observers to be enabled and disabled.
This is useful in situations like model unit tests and the occasional rake task to backfill old data.
2011-04-28 10:23:49 +08:00
Myron Marston
5d20c0a64a Wrap line that is over 200 characters long. Now it's much easier to read. 2011-04-28 10:23:48 +08:00
Sebastian Martinez
c4b494bdc4 Rephrased Dirty#changed? docs 2011-04-26 23:37:11 -03:00
Sebastian Martinez
4554983ab1 Removed extra whitespace 2011-04-26 23:29:11 -03:00
Sebastian Martinez
a2bfa5fa30 Better formatting on ActiveModel::Translation 2011-04-26 23:26:10 -03:00
Sven Fuchs
a5b0f7064c bump the i18n gem to 0.6.0beta1 and update docs for the i18n exception handler [#6739 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-26 15:10:58 +02:00
Josh Kalderimis
bf40c729c6 minor correction to the AMo mass-assignment security docs 2011-04-24 09:58:12 +02:00
Josh Kalderimis
1054ebd613 AM mass assignment security attr_accessible and attr_protected now allow for scopes using :as => scope eg.
attr_accessible :name
    attr_accessible :name, :admin, :as => :admin
2011-04-24 09:53:18 +02:00
Josh Kalderimis
0cf7b2f1b4 minor correction to the Active Model instantiate_observers doc 2011-04-22 15:24:11 +02:00
Xavier Noria
9b423ac0b7 let this regexp be stricter
The purpose of this regexp is to detect strings that
are valid identifiers to be used as method names.
The anchor $ allows a trailing newline, and both ^
and $ may be bypassed because Ruby regexps are
multiline always. The anchors \A and \z are the
proper ones to ensure string boundaries.
2011-04-19 18:16:38 +02:00
José Valim
dca31b9224 Let's not dup because value may not always be duplicable. 2011-04-19 18:06:01 +02:00
José Valim
30472d4244 Avoid define_method if possible. 2011-04-19 17:58:06 +02:00
Aaron Patterson
3e23752236 bcrypt will encrypt anything, so validate_presence_of would not catch nil / blank passwords. Thank you to Aleksander Kamil Modzelewski for reporting this 2011-04-14 14:54:25 -07:00
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
Akira Matsuda
a3fbbb626f 'nil' => nil 2010-12-17 14:37:22 +09:00
Santiago Pastorino
9cfbada93a This is not an executable file 2010-12-16 01:49:28 +05:30
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
Santiago Pastorino
32a2bf8d4e This is not an executable file 2010-12-11 16:40:05 -02:00
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
7c920631ec Test using default option as symbol added for human_attribute_name 2010-12-05 13:26:14 -02: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
Santiago Pastorino
0dbf4ac709 Test falling back to default added for human_attribute_name 2010-12-05 12:36:53 -02:00
Santiago Pastorino
b870d67290 Test using default option added for human_attribute_name 2010-12-05 12:36:51 -02:00
Xavier Noria
48386d245b Merge branch 'master' of git://github.com/lifo/docrails 2010-12-05 10:33:50 +01:00
Sven Fuchs
7ffd5daa7f bump i18n gem
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-04 18:00:31 +01:00
Santiago Pastorino
acbabd9626 Don't compute this string again 2010-12-02 15:43:12 -02:00
Thilo Utke
7148b933c4 ActiveModel::Errors.to_hash returns plain OrderedHash and used in to_json serialization to properly handle multiple errors per attribute [#5615 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-12-01 11:43:37 +01:00
José Valim
1ec126dd37 Revert "Fix generation of wrong json string when field has multiple errors"
This reverts commit a9b666b51d28b2e74da630c31327dee7cbe96d37.
2010-12-01 11:42:30 +01:00
Krekoten' Marjan
a9b666b51d Fix generation of wrong json string when field has multiple errors 2010-12-01 00:03:42 +08:00
Aditya Sanghi
04922bafda grammar fix 2010-11-27 19:56:08 +05:30
raggi
cb1570936d Rakefiles are executables, and rake loads rake, not rakefile code 2010-11-25 06:49:55 +08:00
Aaron Patterson
938243feb9 do not require ruby-debug automatically. please require it if you have declared it as a dependency 2010-11-19 16:26:09 -08:00
Santiago Pastorino
884e3506d2 Bump builder to 3.0.0 2010-11-17 19:35:58 -02:00