Commit Graph

814 Commits

Author SHA1 Message Date
Santiago Pastorino
344ea04865 Fix the build 2012-05-22 12:10:35 -03:00
Santiago Pastorino
38293ea828 require active_support/lazy_load_hooks where is needed 2012-05-22 11:33:03 -03:00
Piotr Sarnacki
08a5b10eb1 Revert "Merge pull request #5702 from oscardelben/patch-4"
This reverts commit cae1ca7d1be9c79c7ef012a1f62aef9d3bb815f8, reversing
changes made to da97cf016a8ffd1f54f804cd881f393e5d6efc18.

These changes break the build, it needs more investigation.
2012-05-20 11:11:20 -07:00
Piotr Sarnacki
cae1ca7d1b Merge pull request #5702 from oscardelben/patch-4
Call undefine_attribute_methods only when defining new attributes
2012-05-19 23:57:58 -07:00
Carlos Antonio da Silva
f20032fa15 Merge pull request #5678 from troyk/patch-1
Remove sort on attributes.keys
2012-05-19 06:08:33 -07:00
Oscar Del Ben
42d0b1c8dd Call undefine_attribute_methods only when defining new attributes 2012-05-18 08:50:57 -07:00
Aaron Patterson
1b604c73f1 Merge pull request #6215 from erichmenge/fix_has_secure_password
Fix has secure password
2012-05-17 10:32:15 -07:00
Vijay Dev
03f8a57487 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activerecord/lib/active_record/core.rb
2012-05-17 17:49:33 +05:30
Naoto Takai
80a2c9e5db Improve logging of ActiveModel::MassAssignmentSecurity::Sanitizer 2012-05-17 06:55:41 +09:00
Francesco Rodriguez
3004bc2470 fixing removed empty lines and examples 2012-05-16 10:01:43 -05:00
Francesco Rodriguez
a9e66c62e9 fixing validates_with docs 2012-05-16 08:56:31 -05:00
Francesco Rodriguez
95e14d1523 better format and fixes to validators docs 2012-05-16 01:23:46 -05:00
Francesco Rodriguez
007c3d8bcb better example format in validates_exclusion_of docs 2012-05-16 00:06:44 -05:00
Tsutomu Kuroda
b0e2fc843b Fix human attribute_name to handle deeply nested attributes
When a model nests another model that also nests yet another model
using accepts_nested_attributes_for method, its Errors object can
have an attribute name with "contacts.addresses.street" style.

In this case, the dots within the namespace should be substituted
with slashes so that we can provide the translation under the
"activemodel.attributes.person/contacts/addresses.street" key.

This commit is related to #3859.
2012-05-16 08:39:48 +09:00
Carlos Antonio da Silva
9b4f5041d2 Kill whitespaces ✂️ 2012-05-15 13:38:29 -03:00
Carlos Antonio da Silva
3d1b078a5b Merge pull request #6284 from acapilleri/dup_validation
clean the erros if an object that includes validation  is duped.
2012-05-15 05:20:57 -07:00
Vijay Dev
59b03d418f Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	actionpack/lib/action_view/helpers/asset_tag_helper.rb
2012-05-15 13:13:55 +05:30
Francesco Rodriguez
00c94d7d94 updating define_attribute_methods documentation 2012-05-14 11:38:23 -05:00
Francesco Rodriguez
05234b358f allow define_attribute_methods to pass multiple values 2012-05-14 11:35:15 -05:00
Alexey Vakhov
7a95d079a3 Missed colon 2012-05-14 09:13:59 +04:00
Angelo Capilleri
f9ae1baa0a clean the erros if an object that includes validations errors is duped. Fixes #5953 2012-05-13 23:24:05 +02:00
ayaya
c140a27fc5 fix alias_attribute will raise a syntax error if make an alias on a
column that named as a ruby keyword
2012-05-14 00:57:29 +08:00
José Valim
7d67880a2d Merge pull request #5729 from oscardelben/use_tap
Use the more idiomatic tap method
2012-05-13 01:00:17 -07:00
Santiago Pastorino
36dd1857dc Remove useless load path modifications 2012-05-11 19:00:35 -03:00
Santiago Pastorino
a00228c1a3 Lazy load I18n 2012-05-11 19:00:25 -03:00
Jon Leighton
a8637cf493 Use respond_to?(:to_ary) rather than is_a?(Enumerable) to detect collection-thing. 2012-05-11 20:11:04 +01:00
Erich Menge
0e1e527654 has_secure_password shouldn't validate password_digest. It should also take options to turn validations off. 2012-05-08 18:08:55 -05:00
Vijay Dev
7e26f7f0f7 simplify the alias_attribute example [ci skip] 2012-05-08 23:54:47 +05:30
Francesco Rodriguez
4831a895c4 added docs to alias_attribute method 2012-05-07 22:47:35 -05:00
Vijay Dev
42ff22f33a Merge branch 'master' of github.com:lifo/docrails 2012-05-01 19:06:03 +05:30
Edward Tsech
6e8f2be51a Add line which gives a little bit more information how *_will_change! works. 2012-05-01 13:52:21 +02:00
Marc-Andre Lafortune
dc74f0cb1b notify_observers should be public 2012-04-30 22:13:26 -04:00
Aaron Patterson
206b43a954 Merge pull request #6063 from marcandre/observer_extra_args
Allow extra arguments for Observers
2012-04-30 16:43:22 -07:00
Marc-Andre Lafortune
24c068d67d Allow extra arguments for Observers 2012-04-30 18:10:03 -04:00
Jeremy Kemper
0393c7cd51 Merge pull request #6071 from marcandre/observer_redef
Fix Observer by acting on singleton class. Fixes #3505.
2012-04-29 21:10:15 -07:00
Marc-Andre Lafortune
bad44e4f8f Fix Observer by acting on singleton class [#3505]
Also [issue #1034] [pull #6068]
2012-04-29 21:51:50 -04:00
Aaron Patterson
f975a8663e Merge pull request #5942 from bcardarella/confirmation_error_message_on_confirmation_attribute
confirmation validation error attribute
2012-04-29 16:29:33 -07:00
Marc-Andre Lafortune
569fb1fffb Generate appropriate error more judiciously 2012-04-29 00:51:56 -04:00
Marc-Andre Lafortune
85c056cc1f Fix error message:
- can pass the class, not the instance
- "instance method" is confusing, use "method :instance" instead
2012-04-28 23:20:42 -04:00
Carlos Antonio da Silva
f48d83b599 Refactor human attribute name 2012-04-28 12:14:59 -03:00
Carlos Antonio da Silva
cafe6a38f5 Do not modify options hash in human_attribute_name, remove reverse_merge 2012-04-28 11:23:29 -03:00
José Valim
fc6b115b88 Merge pull request #6025 from carlosantoniodasilva/amo-errors-refactor
Refactor AMo::Errors
2012-04-28 00:17:18 -07:00
Carlos Antonio da Silva
709b748f09 Refactor AMo::Errors
* Use merge!, remove reverse_merge
* Use case statement instead of is_a? checks
2012-04-27 21:04:13 -03:00
Carlos Antonio da Silva
9d1f6edbe0 Return earlier if attribute already changed in *_will_change! methods
Avoid obtaining the value and duplicating it when possible.
2012-04-27 20:44:09 -03:00
Vijay Dev
43af34c0f6 Merge branch 'master' of github.com:lifo/docrails 2012-04-28 00:56:17 +05:30
Mark Rushakof
8cc4159018 Use <tt>Foo::Bar</tt> instead of +Foo::Bar+
The latter doesn't render as code in HTML output.

Regex used in Rubymine to locate the latter form:

    (\+)(:*\w+:(?::|\w)+)(\+)
2012-04-27 00:00:30 -07:00
Oscar Del Ben
8c16333286 minor docs improvements 2012-04-26 10:34:51 +02:00
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