Oscar Del Ben
26353b993b
Add documentation for validate options
2012-04-26 10:09:12 +02:00
Oscar Del Ben
b2ccae466e
Enhance validations documentation
2012-04-26 09:35:26 +02:00
Vijay Dev
cd65682835
Merge pull request #5878 from oscardelben/refactor_observed_class
...
Refactor Observer.observed_class
2012-04-25 06:06:14 -07:00
Vijay Dev
4a3ce153f1
Merge branch 'master' of github.com:lifo/docrails
2012-04-25 18:33:36 +05:30
Oscar Del Ben
9072a08fac
Refactor Observer.observed_class
2012-04-25 14:46:59 +02:00
Oscar Del Ben
f9f52435e7
fix code syntax
2012-04-25 12:14:08 +02:00
Oscar Del Ben
d089ee8639
Add include documentation to serialization
2012-04-25 12:00:19 +02:00
Oscar Del Ben
a631dd97cb
Minor refactor of serializable hash
2012-04-25 11:46:47 +02:00
Oscar Del Ben
e34a4014ad
improve serialization doc
2012-04-25 11:27:09 +02:00
José Valim
cd556c9388
Merge pull request #5841 from oscardelben/rename_count_observers
...
Rename Observing#count_observers to Observing#observers_count
2012-04-24 23:09:48 -07:00
José Valim
0cc32c5fd7
Merge pull request #5966 from oscardelben/fix_secure_password_setter
...
Fix secure_password setter
2012-04-24 10:50:44 -07:00
Oscar Del Ben
692b3b6b6a
Fix secure_password setter
2012-04-24 19:16:01 +02:00
Oscar Del Ben
52188c77f1
Correct documentation of SecurePassword
2012-04-24 19:08:57 +02:00
Oscar Del Ben
ffa974d55c
Refactor SecurePassword#authenticate
2012-04-24 19:03:59 +02:00
Brian Cardarella
4433b1a99a
Support i18n attributes for confirmation
2012-04-24 01:05:41 -04:00
Brian Cardarella
fcc534ed76
confirmation validation error attribute
...
This will render the error message on :#{attribute}_confirmation instead
of on attribute itself. When rendering confirmation errors inline on the
form with form builders such as SimpleForm and Formtastic it is
confusing to the ender user to see the confirmation error message on the
attribute element. Instead it makes more sense to have this validation
error render on the confirmation field instead.
The i18n message has been updated for the confirmation validator error
message to include the original attribute name.
2012-04-23 17:16:05 -04:00
Oscar Del Ben
7536731a9a
Improve observers documentation
2012-04-18 15:23:06 +02:00
Vijay Dev
5b336ff443
Merge branch 'master' of github.com:lifo/docrails
2012-04-18 00:10:06 +05:30
Thibaut Courouble
0c948a587d
Fix confusing example in ActiveModel::Errors
2012-04-17 19:02:40 +03:00
Jan Xie
6e8a1bd0d3
fix ActiveModel::Validations::Callbacks doc
2012-04-15 20:42:58 +08:00
Michael de Silva
0631b26316
fix bad format [ci skip]
2012-04-14 11:58:43 +03:00
Oscar Del Ben
978221b99c
Rename notify_observers argument *arg to *args to make it more clear
...
that the method accepts multiple arguments
2012-04-14 10:54:10 +02:00
Oscar Del Ben
27d6ccd8c8
Rename Observing#count_observers to Observing#observers_count
2012-04-14 10:48:53 +02:00
Oscar Del Ben
92a6cf0acd
Improve example in initializer
2012-04-14 10:35:44 +03:00
Jon Leighton
e177525d6f
Merge pull request #5736 from oscardelben/configuration_errors_reporting
...
Add better errors reporting for ActiveModel::Configuration
2012-04-11 16:20:42 -07:00
Oscar Del Ben
e6cfd76219
Add better errors reporting for ActiveModel::Configuration
2012-04-04 14:52:44 +02:00
Oscar Del Ben
a3315efde8
Use the more idiomatic tap method
2012-04-04 08:45:58 +02:00
Jurriaan Pruis
2d8396fc9f
Updated/changed useless tr/gsubs
2012-04-03 15:16:09 +02:00
Grant Hutchins
ee235b3d3a
Don't include deprecation in AM::Naming anymore
2012-03-31 21:37:24 -04:00
Troy Kruthoff
cf833b9d97
Remove sort on attributes.keys
2012-03-30 20:39:49 -07:00
José Valim
e83e76eca4
Merge pull request #4904 from ask4prasath/refactor_dirty_module_with_helper
...
Changing active model dirty module helper method to more appropriate met...
2012-03-28 23:47:12 -07:00
Rafael Mendonça França
170956cdae
Remove code duplication in InclusionValidator and ExclusionValidator.
...
Orginal code by @jamescook
Closes #1352
[Rafael Mendonça França + James Cook]
2012-03-28 18:57:56 -03:00
Piotr Sarnacki
c82fd8fc2a
Allow ActiveModel::Name to duck type
2012-03-28 18:25:06 +02:00
Aaron Patterson
65f4d8019f
no need to freeze things all the time
2012-03-26 11:34:01 -07:00
Lukasz Sarnacki
72cbccb5f7
ActiveModel::Name does not inherit from string
2012-03-26 20:15:04 +02:00
José Valim
35e8de6344
Merge pull request #5374 from nertzy/remove_deprecated_partial_path_from_active_model_naming
...
Remove ActiveModel::Naming#partial_path
2012-03-23 05:57:35 -07:00
José Valim
034ccf4048
Speed up mass assignment by avoiding extra loops.
2012-03-16 13:40:42 +01:00
José Valim
eb8f0ddb67
Revert "AM::MassAssingmentSecurity: improve performance"
...
It introduces backwards incompatible changes in the API.
This reverts commit 7d1379ffdbbaf01e99833dc06611b7e4f3799522.
2012-03-15 18:41:54 +01:00
Bogdan Gusiev
7d1379ffdb
AM::MassAssingmentSecurity: improve performance
2012-03-14 14:11:52 +02:00
Grant Hutchins
bf8d7574bf
Remove ActiveModel::Naming#partial_path
...
It was deprecated in 3.2
2012-03-10 18:02:36 -05:00
Grant Hutchins
e78c5eeba1
Fix comments about to_partial_path
2012-03-10 17:40:27 -05:00
Carlos Antonio da Silva
3508da50f0
Rename variable to avoid using name "include"
...
Better syntax highlight :)
2012-03-09 22:07:59 -03:00
Carlos Antonio da Silva
3d04d726fd
Remove Array#wrap usage in AMo serialization
2012-03-09 21:56:05 -03:00
Carlos Antonio da Silva
10c3304db6
Make sure serializable hash with :include always returns string keys
2012-03-09 21:51:12 -03:00
Shane Hanna
2b97b8fb9e
Added missing ActiveModel::Naming dependency.
...
ActiveModel::Name constructor expects to be able to call #blank? on a
String but the core Object#blank? extension is never required.
2012-03-09 15:46:24 +11:00
Vijay Dev
188d1d2787
Merge branch 'master' of github.com:lifo/docrails
2012-03-09 00:07:59 +05:30
Carlos Antonio da Silva
e64dbb5b36
Improve docs for attr_accessible|protected related to Hash#except|slice
2012-03-06 23:52:03 -03:00
Vijay Dev
c0a7999115
minor corrections in AMo::Model docs [ci skip]
2012-03-05 22:46:44 +05:30
Guillermo Iguaran
247706e259
Use public_send instead of send in ActiveModel::Model initialize
2012-03-03 10:36:03 -05:00
Carlos Antonio da Silva
cb9d03f0d4
Add docs with usage examples for ActiveModel::Model
...
Also add test to ensure basic model does not explode when
initialized with nil.
2012-03-03 04:45:30 -03:00
Guillermo Iguaran
3b822e91d1
Add ActiveModel::Model, a mixin to make Ruby objects to work with AP inmediatly
2012-03-02 23:59:55 -05:00
Xavier Noria
7f2548e34d
Merge pull request #5130 from dlee/revised_patch_verb
...
Add config.default_method_for_update to support PATCH
2012-02-22 09:00:53 -08:00
David Lee
002713c645
Add config.default_method_for_update to support PATCH
...
PATCH is the correct HTML verb to map to the #update action. The
semantics for PATCH allows for partial updates, whereas PUT requires a
complete replacement.
Changes:
* adds config.default_method_for_update you can set to :patch
* optionally use PATCH instead of PUT in resource routes and forms
* adds the #patch verb to routes to detect PATCH requests
* adds #patch? to Request
* changes documentation and comments to indicate support for PATCH
This change maintains complete backwards compatibility by keeping :put
as the default for config.default_method_for_update.
2012-02-22 08:47:10 -08:00
Benjamin Quorning
5742f12b78
Prefer || over 'or' for boolean operations
2012-02-22 10:13:27 +01:00
Aaron Patterson
5d0c1814ad
ruby 2.0 makes protected methods return false for respond_to, so pass true as the second param
2012-02-21 10:33:16 -08:00
Bogdan Gusiev
534dc4ca1a
AM::Errors: allow :full_messages parameter for #as_json
2012-02-20 11:17:11 +02:00
Fabio Yamate
d204918f91
Fix sanitize_for_mass_assigment when role is nil
...
There is an example in Rails documentation that suggests implementing
assign_attributes method for ActiveModel interface, that by default
sends option role with nil. Since mass_assignment_authorizer never
is called without args, we can move the default value internally.
2012-02-15 11:13:54 -02:00
Sergey Nartimov
b5f5e279a6
remove unnecessary require core_ext/string/encoding
2012-02-14 10:09:21 +03:00
Aaron Patterson
9bcfb1a974
Merge pull request #5018 from hammerdr/issue-4659-docs
...
Adding documentation to clarify usage of attributes hash.
2012-02-13 09:00:59 -08:00
Carlos Antonio da Silva
ad9f968c4a
Make sure serializable hash with :methods option returns always string keys
2012-02-13 11:22:59 -02:00
Derek Hammer
a3a1a6f9ed
Missed a code example. Fixing the docs to be consistant.
2012-02-12 08:17:18 -06:00
Derek Hammer
a469ec787c
Adding documentation to clarify usage of attributes hash.
...
Serialization uses only the attributes hash's keys and calls
methods that are of the same name as the keys on the serialized
object.
2012-02-12 08:08:09 -06:00
Aaron Patterson
06b9c905a9
Merge pull request #4930 from ask4prasath/ordered_hash_replaced
...
Replacing ordered hash to ruby hash on active model
2012-02-08 08:59:00 -08:00
José Valim
a17d047a73
Trim down Active Model API by removing valid? and errors.full_messages
2012-02-07 23:10:43 +01:00
prasath
47628ec128
replacing ordered hash to ruby hash
2012-02-08 00:34:47 +05:30
Prasath Venkatraman
5e70522100
Changing active model dirty module helper method to more appropriate method with helper #4903
...
Changing active model dirty module helper method to more appropriate method with helper with Active Support Helper #4903
Changing active model dirty module helper method to more appropriate method with helper with Active Support Helper typo fixed #4903
2012-02-06 18:10:27 +05:30
Niels Ganser
60dad828ae
To infinity… and beyond!
...
Allow infinite values for validates_length_of. Particularly useful
for prettily defining an open ended range such as
validates_length_of :human_stupidity, :within => 0..Float::INFINITY
2012-02-06 12:58:32 +01:00
Bogdan Gusiev
7661955634
AS::Callbacks: :skip_after_callbacks_if_terminated option
2012-02-03 17:57:53 +02:00
Vijay Dev
d7a85c5c51
revise docs [ci skip]
2012-02-01 23:31:43 +05:30
Carlos Antonio da Silva
26861e9506
Generate strict validation error messages with attribute name
2012-02-01 11:34:17 -02:00
Aaron Beckerman
9d119c5fee
fix example code in documentation for has_secure_password
2012-01-28 00:53:02 +11:00
Vijay Dev
203771da9e
Merge branch 'master' of github.com:lifo/docrails
2012-01-26 00:00:40 +05:30
Jonathan del Strother
73e71c27f2
Fix translate_error reference for Error#add documentation
2012-01-25 15:02:20 +00:00
Manoj
204aabc24c
quote fix ` to ' in the ArgumentError message
...
message quote fix
2012-01-24 22:10:06 +05:30
Aaron Patterson
0c356109ff
remove unused captures
2012-01-19 17:08:53 -08:00
dreamfall
7c3a5ec499
whitespaces
2012-01-17 13:19:30 +03:00
dreamfall
e84998cc21
validates method should not change options argument
2012-01-17 13:18:58 +03:00
Paweł Kondzior
6174d3ba24
Remove redundant #to_sym
2012-01-16 23:24:14 -08:00
Paweł Kondzior
5313eab695
Fix ActiveModel::Errors#dup
...
Since ActiveModel::Errors instance keeps all error messages as hash
we should duplicate this object as well.
Previously ActiveModel::Errors was a subclass of ActiveSupport::OrderedHash,
which results in different behavior on `dup`, this may result in regression for
people relying on it.
2012-01-16 23:22:51 -08:00
Piotr Sarnacki
8e8982cf3b
Add ActiveModel::Errors#delete, which was not available after move to use delegation
2012-01-16 17:23:40 +01:00
Piotr Sarnacki
b164e81c11
Fix stack level too deep when model does not have attributes method.
...
Without that patch when using ActiveModel::AttributeMethods
in a class that does not respond to `attributes` method,
stack level too deep error will be raised on non existing
method. While documentation is clear that you need to define
`attributes` method in order to use AttributeMethods module,
`stack level too deep` is rather obscure and hard to debug,
therefore we should try to not break `method_missing` if
someone forgets about defining `attributes`.
2012-01-15 15:54:59 +01:00
Vijay Dev
7c29246b8c
Merge branch 'master' of github.com:lifo/docrails
2012-01-11 20:18:55 +05:30
Karunakar (Ruby)
abf55eba90
removed unnessary require active_support/core_ext/array_wrap
2012-01-06 23:21:39 +05:30
Santiago Pastorino
fc956425d4
Revert "Revert "More 1.9 way""
...
Fixed failing tests
This reverts commit 8350ce97f2065eed9638c595d3938a573d6fa343.
2012-01-06 11:04:18 -02:00
Rafael Mendonça França
2a663dcf09
Remove Array.wrap call in ActiveModel
2012-01-06 01:04:33 -03:00
Aaron Patterson
8350ce97f2
Revert "More 1.9 way"
...
This reverts commit 675094b2757cf90399dadca4489b1036810ae570.
2012-01-05 17:05:44 -08:00
Santiago Pastorino
675094b275
More 1.9 way
2012-01-05 20:16:09 -02:00
Aaron Patterson
da4fef8155
use logger.warn for warnings
2012-01-04 13:37:47 -08:00
Alan Harper
6e9bbe3d0b
Update ConfirmationValidator docs, correct when the validator runs
2012-01-05 08:26:34 +11:00
Aaron Patterson
07c192a705
push exception message formatting to the exception class
2012-01-04 13:25:33 -08:00
Aaron Patterson
fd2d78dbc8
push target down to the classes that care about it
2012-01-04 13:15:59 -08:00
Aaron Patterson
54b4e8e8d6
just implement the delegate method
2012-01-04 13:15:59 -08:00
Aaron Patterson
b899b7be51
Array.wrap no longer needed
2012-01-04 13:15:59 -08:00
Steve Richert
5de4545dde
Fix grammatical error in ActiveModel::MassAssignmentSecurity::PermissionSet#deny? NotImplementedError message
2012-01-02 14:45:09 -05:00
Vijay Dev
f3e079e8b5
Merge pull request #4248 from andrew/2012
...
Updated copyright notices for 2012
2011-12-31 12:48:19 -08:00
Andrew Nesbitt
1b413510fe
Updated copyright notices for 2012
2011-12-31 20:30:08 +00:00
Jon Leighton
93c1f11c0a
Support configuration on ActiveRecord::Model.
...
The problem: We need to be able to specify configuration in a way that
can be inherited to models that include ActiveRecord::Model. So it is
no longer sufficient to put 'top level' config on ActiveRecord::Base,
but we do want configuration specified on ActiveRecord::Base and
descendants to continue to work.
So we need something like class_attribute that can be defined on a
module but that is inherited when ActiveRecord::Model is included.
The solution: added ActiveModel::Configuration module which provides a
config_attribute macro. It's a bit specific hence I am not putting this
in Active Support or making it a 'public API' at present.
2011-12-28 18:27:41 +00:00
José Valim
b28ed2bd4f
Merge pull request #4172 from nashby/refactor-tokenizer
...
don't call an extra method if options[:tokenizer] is not present
2011-12-24 12:48:45 -08:00
Vasiliy Ermolovich
fdbd6779fe
don't call an extra method if options[:tokenizer] is not present
2011-12-24 23:40:09 +03:00
Sergey Nartimov
9813c62330
remove deprecated define_attr_method from ActiveModel::AttributeMethods
2011-12-24 21:26:15 +03:00
Vasiliy Ermolovich
ee2095e107
use Range#min and Range#max to reduce extra statement
2011-12-24 19:33:45 +03:00
Sergey Nartimov
5ca86ac8f9
deprecate String#encoding_aware? and remove its usage
2011-12-24 15:57:54 +03:00
Bogdan Gusiev
150217f54f
AM::MAS.attr_protected: rework usage example.
2011-12-23 10:05:39 +02:00
Bogdan Gusiev
46ec75661d
Fixed AM::MasAsSec.attr_protected usage example.
...
Problems with current example:
* DOESN'T WORK
** attr_protected :last_login, :as => :admin # doesn't make it accessible for admin
* Uses ActiveSupport Fixnum extension
2011-12-22 10:57:06 +02:00
Bogdan Gusiev
24a6609ea3
Fix AM::MassAssignementSecurity doc
2011-12-22 10:24:20 +02:00
Jakub Kuźma
0fe311a7fc
added :other_than => :!= option to numericality validator
2011-12-21 10:54:44 +01:00
José Valim
7ba28d434c
Remove dead code from AMo.
2011-12-20 18:38:20 +01:00
David Heinemeier Hansson
632fa15fa4
rails/master is now 4.0.0.beta and will only support Ruby 1.9.3+
2011-12-20 09:30:37 -06:00
David Heinemeier Hansson
9d6e52b55e
Party like its R-C-UNO!
2011-12-19 18:34:57 -06:00
Antonio Roberto
66e747b461
Fixed bug when error message is an empty string.
2011-12-16 17:17:14 -02:00
José Valim
7280787a53
Improve cache on route_key lookup.
2011-12-08 19:53:16 +01:00
José Valim
f0f0e59c10
Ensure length validator also works on 1.8.7.
2011-12-06 14:13:44 +01:00
José Valim
81fec5dfc4
Merge pull request #3872 from marcandre/i18n_key
...
ActiveModel::Name#i18n_key: Fix doc and add tests
2011-12-06 00:41:43 -08:00
José Valim
1ee832b2d8
Merge pull request #3873 from iangreenleaf/no_default_tokenizer
...
Don't tokenize string when counting characters
2011-12-06 00:41:05 -08:00
Marc-Andre Lafortune
d834755dad
ActiveModel::Name#i18n_key: Fix doc and add tests
2011-12-05 22:02:53 -05:00
José Valim
d4964b3386
Namespaced attribute lookup now works as 'model/association.attribute'.
2011-12-05 15:39:41 +01:00
José Valim
2985151000
Merge pull request #3859 from kuroda/human_attribute_name
...
Fix human_attribute_name to handle names with dots
2011-12-05 06:09:33 -08:00
Tsutomu Kuroda
dff19f7be2
Fix human_attribute_name to handle names with dots
...
Nested I18n namespace lookup under activerecord.models is deprecated now (c19bd4f).
But when a model uses accepts_nested_attributes_for, its Errors object can have
an attribute name with "addresses.street" style. In this case, the dots should be
substituted with slashes so that we can provide the translation under the
"activemodel.attributes.person.addresses/street" key.
2011-12-05 22:57:47 +09:00
Ian Young
5ff71ac9f8
Don't tokenize string when counting characters
2011-12-04 23:20:54 -08:00
Alexey Vakhov
814a4c3160
Fix argument error message for length validation
2011-12-01 09:12:16 +04:00
Vijay Dev
88daf08258
Merge branch 'master' of github.com:lifo/docrails
2011-11-30 23:32:01 +05:30
José Valim
5b2eb64ceb
Revert "Implement ArraySerializer and move old serialization API to a new namespace."
...
This reverts commit 8896b4fdc8a543157cdf4dfc378607ebf6c10ab0.
Conflicts:
activemodel/lib/active_model.rb
activemodel/lib/active_model/serializable.rb
activemodel/lib/active_model/serializer.rb
activemodel/test/cases/serializer_test.rb
2011-11-30 18:48:17 +01:00
José Valim
38ab982cff
Log 'Filter chain halted as CALLBACKNAME rendered or redirected' every time a before callback halts.
2011-11-30 09:53:09 +01:00
Jon Leighton
8df787d428
Deprecated define_attr_method
in ActiveModel::AttributeMethods
...
This only existed to support methods like `set_table_name` in Active
Record, which are themselves being deprecated.
2011-11-29 20:13:37 +00:00
Alexey Vakhov
448df2d100
Cosmetic fixes in AM validatations docs
2011-11-27 10:23:40 +04:00
Vijay Dev
1d89540686
Merge branch 'master' of github.com:lifo/docrails
2011-11-26 19:14:39 +05:30
José Valim
0a4035b12a
Revert the serializers API as other alternatives are now also under discussion
2011-11-25 19:29:39 +00:00
José Valim
fcacc6986a
Merge branch 'serializers'
...
This implements the ActiveModel::Serializer object. Includes code, tests, generators and guides.
From José and Yehuda with love.
Conflicts:
railties/CHANGELOG.md
2011-11-25 09:59:35 +00:00
José Valim
696d01f7f4
Add docs to serializers. Update CHANGELOGs.
2011-11-25 09:49:54 +00:00
Jakub Kuźma
dc39af0a9a
make ActiveModel::Name fail gracefully with anonymous classes
2011-11-24 15:50:21 +01:00
José Valim
7fcc8c0a1f
Rely solely on active_model_serializer and remove the fancy constant lookup.
2011-11-23 23:45:27 +00:00
José Valim
8896b4fdc8
Implement ArraySerializer and move old serialization API to a new namespace.
...
The following constants were renamed:
ActiveModel::Serialization => ActiveModel::Serializable
ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON
ActiveModel::Serializers::Xml => ActiveModel::Serializable::XML
The main motivation for such a change is that `ActiveModel::Serializers::JSON`
was not actually a serializer, but a module that when included allows the target to be serializable to JSON.
With such changes, we were able to clean up the namespace to add true serializers as the ArraySerializer.
2011-11-23 23:18:15 +00:00
José Valim
e62de52aa3
Merge branch 'master' into serializers
2011-11-23 20:43:06 +00:00
José Valim
fd86a1b6b0
Rely on a public contract between railties instead of accessing railtie methods directly.
2011-11-23 19:06:45 +00:00
Alexey Vakhov
efbb73562d
Small docs fix in Active Model callbacks module
2011-11-19 12:19:59 +06:00
José Valim
9fa329b754
Speed up attribute invocation by checking if both name and calls are compilable.
2011-11-14 20:12:17 +01:00
Oscar Del Ben
af64ac4e5c
use any? instead of !empty?
2011-11-14 16:56:05 +01:00
Jean Boussier
fd17ffc7a2
Fix a tiny typo in custom validators documentation
2011-11-10 18:49:37 +01:00
Anand
4cef581fcf
replaced remove and define method calls to :redefine
2011-11-07 16:22:30 +05:30
bradrobertson
2e62af310d
correct documentation on initialize method to accept a single parameter
2011-10-26 09:31:37 -04:00
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
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
Jose and Yehuda
2abb2e617a
Add initial support for embed API
2011-10-15 19:22:16 +02:00
Jose and Yehuda
a230f040ff
Add support for the root attribute
2011-10-15 18:56:47 +02:00
Jose and Yehuda
7a28498b55
Fix nil has_one association
2011-10-15 18:40:38 +02:00
Jose and Yehuda
322f47898e
Add association_ids
2011-10-15 18:40:38 +02:00
Jose and Yehuda
22c322f056
Add support for overriding associations, mostly used for authorization
2011-10-15 18:40:38 +02:00
Jose and Yehuda
776da539d7
Add support for implicit serializers
2011-10-15 18:40:38 +02:00
Jose and Yehuda
2a4aaae72a
Added has_one and has_many
2011-10-15 18:40:37 +02:00
Jose and Yehuda
e407dfb9bf
Don't require serializable_hash to take options.
2011-10-15 18:40:37 +02:00
Jose and Yehuda
c3de52d7ed
Initial implementation of ActiveModel::Serializer
2011-10-15 18:40:37 +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
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
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
51bef9d8fb0b4da7a104425ab8545e9331387743, 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
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
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
Anand
1be3442a0a
added missing require array/wrap in serialization
2011-08-23 16:30:02 +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
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
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
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
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
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
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
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
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
Guillermo Iguaran
657ba2a9f0
Remove trailing whitespaces
2011-06-12 10:31:21 -05: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
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
Sebastian Martinez
2a4b780ab1
Remove extra white spaces on ActiveModel docs.
2011-05-23 20:39:10 -03: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
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
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
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
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