Commit Graph

743 Commits

Author SHA1 Message Date
Vijay Dev
af1b5c54cf Merge branch 'master' of github.com:lifo/docrails 2011-10-20 23:20:44 +05:30
Martin Svalin
930dc335d7 Removed mention of deprecated ActiveModel::Errors#on 2011-10-19 23:13:15 +02:00
Martin Svalin
c9ca86c29d New #added? method on ActiveModel::Errors
The #added? method makes it possible to check if a specific error has been added, using the same parameters as for #add.
2011-10-19 21:29:20 +02:00
Vijay Dev
8dffc62a9b use variables from test setup 2011-10-17 19:15:24 +05:30
Vijay Dev
826a850696 fix a typo and slightly reword has_secure_password comment 2011-10-17 19:14:29 +05:30
Martin Svalin
180d4137ca ActiveModel::Errors#generate_message without i18n_scope, and more test cases for #add 2011-10-17 09:22:08 +02:00
Vijay Dev
e759c8882a Merge branch 'master' of github.com:lifo/docrails 2011-10-14 22:21:40 +05:30
zhengjia
1adf5662b5 Fixed serialization issues with multiple includes with options 2011-10-11 11:09:43 -05:00
Evgeniy Dolzhenko
c317419359 Use .add instead of << to add errors 2011-10-11 14:13:08 +01:00
Uģis Ozols
4015080efd One of the activemodel naming tests wasn't asserting anything. 2011-10-07 16:42:44 +03:00
Vijay Dev
46ce7f1f77 Merge branch 'master' of github.com:lifo/docrails 2011-10-05 18:42:18 +05:30
Robert Ross
ac49fb1aa9 Change one more place for JSON string to Hash 2011-10-04 23:42:37 -07:00
Robert Ross
eef176dc7d Fix as_json doc to say what it actually returns. 2011-10-04 09:37:54 -07:00
José Valim
d4457dc32b Provide read_attribute_for_serialization as the API to serialize attributes. 2011-09-30 14:20:41 +02:00
Nicolás Hock Isaza
da914fa35c Fixing as_json method for ActiveRecord models.
When you've got an AR Model and you override the `as_json` method,
you should be able to add default options to the renderer, like this:

    class User < ActiveRecord::Base
      def as_json(options = {})
        super(options.merge(:except => [:password_digest]))
      end
    end

This was not possible before this commit. See the added test case.
2011-09-29 21:44:23 -05:00
Uģis Ozols
62a9e5a960 Class name specified in example is Person, not AttributePerson. 2011-09-29 14:33:32 +03:00
Jon Leighton
a15424b92c Make serializable_hash take attr values directly from attributes hash.
Previously, it would use send() to get the attribute. In Active
Resource, this would rely on hitting method missing. If a method with
the same name was defined further up the ancestor chain, that method
would wrongly be called.

This change fixes test_to_xml_with_private_method_name_as_attribute in
activeresource/test/cases/base_test.rb, which was broken after
51bef9d8fb, because that change made
to_xml use serializable_hash.
2011-09-26 12:40:03 +01:00
José Valim
4bfbdc133a Refactor AMo as_json. 2011-09-23 00:19:46 +02:00
Matt Aimonetti
6e78bbea90 fixed a bug with the json serialization when the class setting is set to not include the root, but an instance is serialized with the root option passed as true 2011-09-22 14:05:25 -07:00
José Valim
51bef9d8fb to_xml should also rely on serializable hash. 2011-09-18 09:09:01 -07:00
Vijay Dev
823e16f57c update 3.1 release date in changelogs 2011-09-14 22:46:12 +05:30
Jon Leighton
778c82bea6 Generate attribute method unless it's already in the module.
There's no harm in generating a method name that's already defined on
the host class, since we're generating the attribute methods in a module
that gets included. In fact, this is desirable as it allows the host
class to call super.
2011-09-14 00:00:37 +01:00
Jon Leighton
c89e1c7bde Add an attribute_missing method to ActiveModel::AttributeMethods.
This can be overloaded by implementors if necessary.
2011-09-13 00:02:33 +01:00
Jon Leighton
6d8dbeca6b Avoid double super call in some cases.
If super was false earlier, it is still going to be false, so we don't
need to call it again at the end of the method.
2011-09-13 00:01:58 +01:00
Jon Leighton
ac687ed651 Let Ruby deal with method visibility.
Check respond_to_without_attributes? in method_missing. If there is any
method that responds (even private), let super handle it and raise
NoMethodError if necessary.
2011-09-13 00:01:58 +01:00
Jon Leighton
99bd6b53da Add deprecation for doing attribute_method_suffix '' 2011-09-13 00:01:57 +01:00
Jon Leighton
93d574c962 refactoring 2011-09-13 00:01:57 +01:00
Jon Leighton
8b8b7143ef Use an empty AttributeMethodMatcher by default.
This means that attribute methods which don't exist will get generated
when define_attribute_methods is called, so we don't have to use hacks
like `attribute_method_suffix ''`.
2011-09-13 00:01:57 +01:00
Lawrence Pit
8817796167 Added test for obj.errors.as_json 2011-09-09 18:34:13 +10:00
Lawrence Pit
f5a944f662 Add ability to get an individual full error message + test for full_messages. 2011-09-09 18:28:25 +10:00
Damien Mathieu
e0335e2ccb add has_key? to ActiveModel::Errors 2011-09-06 18:36:18 +02:00
Guillermo Iguaran
9b02f3f41f Add comments about bcrypt-ruby gem to SecurePassword 2011-09-03 00:44:33 -05:00
Vijay Dev
eeda8403fd Merge branch 'master' of github.com:lifo/docrails 2011-09-02 23:00:59 +05:30
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