Rafael Mendonça França
53edd32684
validates_inclusion_of
and validates_exclusion_of
now accept
...
`:within` option as alias of `:in` as documented.
Fix #7118
2012-07-20 13:53:31 -03:00
Bogdan Gusiev
c175563b88
AM::Validations: remove documentation duplicates
2012-07-10 10:07:38 +03:00
Vijay Dev
ee20be7c33
Merge branch 'master' of github.com:lifo/docrails
2012-07-07 20:44:49 +05:30
Carlos Antonio da Silva
d4f59783d2
Merge pull request #6938 from acapilleri/as_json_refactoring
...
Small refactoring of as_json method
2012-07-07 06:39:56 -07:00
Francesco Rodriguez
ca802fda66
add :nodoc: to internal implementations of AM::Validator [ci skip]
2012-07-06 00:17:13 -05:00
Francesco Rodriguez
9a7702a1df
update ActiveModel::Serialization documentation [ci skip]
2012-07-06 00:09:08 -05:00
Francesco Rodriguez
70c4676d88
fix syntax of AM::Validations::HelperMethods examples [ci skip]
2012-07-05 11:19:20 -05:00
Francesco Rodriguez
68df230255
update ActiveModel::Validations::HelperMethods documentation [ci skip]
2012-07-05 00:09:29 -05:00
Francesco Rodriguez
6e00099a28
update ActiveModel::Conversion documentation [ci skip]
2012-07-04 23:11:47 -05:00
Angelo Capilleri
fde7fd8693
small refactoring of as_json method
...
with this change root has always one assignment
2012-07-03 15:11:41 +02:00
Angelo Capilleri
17fa4ef666
observer update refactoring
2012-07-03 09:08:33 +02:00
Laknath
0149a6eef9
Changed attr_accessible example to reflect grouped roles
...
Related to the request #5699 - https://github.com/rails/rails/pull/5699 and
not documented.
2012-07-01 10:14:13 +05:30
Vijay Dev
6b9d1a0db2
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
activemodel/lib/active_model/errors.rb
2012-06-30 23:15:22 +05:30
Carlos Antonio da Silva
4a20fcf7b2
Refactor attribute method matcher to use Hash#fetch
2012-06-26 22:21:19 -03:00
Carlos Antonio da Silva
7fad77fcc7
Cleanup attribute methods a bit, use map! when accepting *args
...
Since we're dealing with a new array instance, it's safe to use map! and
we avoid an extra array object.
Also remove the symbolize_keys! from AttributeMethodMatcher, since it's
an internal class that always receives symbol keys from the prefix/suffix
methods implementations.
2012-06-26 22:21:18 -03:00
Carlos Antonio da Silva
fef781cac4
Use default + merge! instead of reverse_merge
...
Since we're not directly requiring the reverse_merge extension, we can
avoid another hash creation by using default_hash.merge! instead.
2012-06-26 22:21:18 -03:00
Carlos Antonio da Silva
0ee6aa749c
Set hash value instead of merge a single key, and use flatten! if possible
...
There's no need to create two extra hashes with options.merge(another_hash),
with the goal of setting only one value, so lets just set it.
Also refactor validates_each to use _merge_attributes, like other
validates_* helpers do.
2012-06-26 22:21:18 -03:00
Francesco Rodriguez
65362af7a8
add :nodoc: to internal implementations [ci skip]
2012-06-25 12:14:50 -05:00
Carlos Antonio da Silva
2a7cfee13e
Make internal callback model definitions private in AMo
...
These _define class methods don't need to be exposed to objects that
extend ActiveModel::Callbacks.
Also use merge! options to avoid the creation of an extra hash.
2012-06-25 13:21:26 -03:00
Francesco Rodriguez
809d4f8eb2
update ActiveModel::Name documentation [ci skip]
2012-06-25 10:40:54 -05:00
Francesco Rodriguez
5130d862a5
fix punctuation in activemodel/errors [ci skip]
2012-06-25 02:23:33 -05:00
Francesco Rodriguez
87615f28e0
update ActiveModel::Naming documentation
2012-06-23 16:58:36 -05:00
Francesco Rodriguez
cca9a21a82
update ActiveModel::Model documentation [ci skip]
2012-06-23 15:12:33 -05:00
Francesco Rodriguez
ffe16b16cd
add description ActiveModel::StrictValidationField [ci skip]
2012-06-23 14:49:22 -05:00
Francesco Rodriguez
62a13093c0
update ActiveModel::Lint documentation [ci skip]
2012-06-22 18:01:12 -05:00
Francesco Rodriguez
311810b8b2
update ActiveModel::Errors#include? documentation [ci skip]
2012-06-22 16:48:50 -05:00
Francesco Rodriguez
bc7ac33846
add :nodoc: to internal implementations [ci skip]
2012-06-22 16:29:59 -05:00
Francesco Rodriguez
1727f4330c
add documentation and examples to ActiveModel::Errors [ci skip]
2012-06-22 16:04:16 -05:00
Francesco Rodriguez
629bc03bf8
change param name to improve documentation
...
The keys of the error messages are actually attribute names. It makes
the documentation easier to understand:
# Returns +true+ if the error messages include an error for the given
# +attribute+, +false+ otherwise.
#
# person.errors.messages # => { :name => ["can not be nil"] }
# person.errors.include?(:name) # => true
# person.errors.include?(:age) # => false
def include?(attribute)
(v = messages[attribute]) && v.any?
end
2012-06-22 12:42:32 -05:00
Francesco Rodriguez
bc818e4bc5
update ActiveModel::Errors documentation and minor fixes [ci skip]
2012-06-22 11:54:15 -05:00
Francesco Rodriguez
d9238d044a
update ActiveModel::Conversion documentation [ci skip]
2012-06-22 11:54:15 -05:00
Vijay Dev
35ee8fa3d8
Merge branch 'master' of github.com:lifo/docrails
2012-06-22 22:15:27 +05:30
Vijay Dev
6285675db1
fixes a few mistakes in api docs [ci skip]
2012-06-22 22:14:29 +05:30
Rafael Mendonça França
fb8cf55868
Merge pull request #6800 from mschneider/dynamic_finders_for_aliased_attributes
...
Dynamic finders for aliased attributes
2012-06-22 07:51:11 -07:00
Maximilian Schneider
f984b8152f
made dynamic finders alias_attribute aware
...
previously dynamic finders only worked in combination with the actual
column name and not its alias defined with #alias_attribute
2012-06-22 16:44:01 +02:00
Carlos Antonio da Silva
965b779eb2
Add some coverage for AR serialization with serializable_hash
...
ActiveRecord json/xml serialization should use as base
serializable_hash, provided by ActiveModel. Add some more coverage
around options :only and :except for both json and xml serialization.
2012-06-22 08:28:03 -03:00
Francesco Rodriguez
d569bfed0d
update ActiveModel::Callbacks documentation [ci skip]
2012-06-22 00:32:54 -05:00
Francesco Rodriguez
c3025e8d59
add description to ActiveModel::MissingAttributeError [ci skip]
2012-06-21 16:56:40 -05:00
Francesco Rodriguez
1ce803d091
add :nodoc: to AM::AttributeMethods#instance_method_already_implemented? [ci skip]
2012-06-21 16:40:17 -05:00
Francesco Rodriguez
95a938a5e6
add example to ActiveModel::AttributeMethods#undefine_attribute_methods [ci skip]
2012-06-21 16:19:40 -05:00
Francesco Rodriguez
f975c4b641
add docs to AM::AttributeMethods#define_attribute_method [ci skip]
2012-06-21 15:51:37 -05:00
Francesco Rodriguez
1cb2cb8bea
add :nodoc: to AM::AttributeMethods::AttributeMethodMatcher [ci skip]
2012-06-21 15:37:09 -05:00
Francesco Rodriguez
b5b350ad5c
fix ActiveModel::AttributeMethods#alias_attribute documentation [ci skip]
2012-06-21 12:51:39 -05:00
Francesco Rodriguez
bf3332bfdf
update ActiveModel::AttributeMethods documentation [ci skip]
2012-06-21 12:26:14 -05:00
Jon Leighton
e030f26ad3
Simplify AR configuration code.
...
Get rid of ActiveModel::Configuration, make better use of
ActiveSupport::Concern + class_attribute, etc.
2012-06-15 19:15:36 +01:00
Francesco Rodriguez
62f6277c53
add example to ActiveModel::Validations#validators [ci skip]
2012-06-15 11:38:07 -05:00
Vijay Dev
c1474ff2e7
Merge branch 'master' of github.com:lifo/docrails
2012-06-14 22:52:38 +05:30
MrBrdo
bc7c0b5c10
prevent users from unknowingly using bad regexps that can compromise security ( http://homakov.blogspot.co.uk/2012/05/saferweb-injects-in-various-ruby.html )
2012-06-14 18:10:49 +02:00
Akira Matsuda
588bb6b987
Range#cover? is not implemented in AS now
2012-06-12 02:29:21 +09:00
Robb Kidd
f20208842a
Make observer enable/disable documentation more informative.
...
* Moved the simplest case--enable/disable all on all--to the top.
* Made clear what "ORM" means to avoid having to teach people how to solve "uninitialized constant ORM"
errors in their test reports.
2012-06-09 16:04:01 -03:00
Piotr Sarnacki
41d63710f2
Merge pull request #6668 from pomnikita/master
...
Compact array of values added to PermissionSet instance
2012-06-08 11:35:13 -07:00
Nikita Pomyashchiy
00ff0a6776
Compact array of values added to PermissionSet instance
2012-06-08 01:00:34 +04:00
Francesco Rodriguez
ab11a2780f
change AMS::JSON.include_root_in_json default value to false
...
Changes:
* Update `include_root_in_json` default value to false for default value
to false for `ActiveModel::Serializers::JSON`.
* Remove unnecessary change to include_root_in_json option in
wrap_parameters template.
* Update `as_json` documentation.
* Fix JSONSerialization tests.
Problem:
It's confusing that AM serializers behave differently from AR,
even when AR objects include AM serializers module.
class User < ActiveRecord::Base; end
class Person
include ActiveModel::Model
include ActiveModel::AttributeMethods
include ActiveModel::Serializers::JSON
attr_accessor :name, :age
def attributes
instance_values
end
end
user.as_json
=> {"id"=>1, "name"=>"Konata Izumi", "age"=>16, "awesome"=>true}
# root is not included
person.as_json
=> {"person"=>{"name"=>"Francesco", "age"=>22}}
# root is included
ActiveRecord::Base.include_root_in_json
=> false
Person.include_root_in_json
=> true
# different default values for include_root_in_json
Proposal:
Change the default value of AM serializers to false, update
the misleading documentation and remove unnecessary change
to false of include_root_in_json option with AR objects.
class User < ActiveRecord::Base; end
class Person
include ActiveModel::Model
include ActiveModel::AttributeMethods
include ActiveModel::Serializers::JSON
attr_accessor :name, :age
def attributes
instance_values
end
end
user.as_json
=> {"id"=>1, "name"=>"Konata Izumi", "age"=>16, "awesome"=>true}
# root is not included
person.as_json
=> {"name"=>"Francesco", "age"=>22}
# root is not included
ActiveRecord::Base.include_root_in_json
=> false
Person.include_root_in_json
=> false
# same behaviour, more consistent
Fixes #6578 .
2012-06-06 01:11:39 -05:00
Vijay Dev
40d5303b4f
Merge branch 'master' of github.com:lifo/docrails
2012-06-02 21:50:02 +05:30
Rafael Mendonça França
3449b757da
Sync CHANGLOG with the 3-2-stable branch
2012-06-01 11:41:30 -03:00
Francesco Rodriguez
f87820d00a
update ActiveModel::Dirty documentation
2012-05-31 05:06:00 -05:00
José Valim
555d8152c7
Merge pull request #5843 from kuroda/translation_of_deeply_nested_model_attributes
...
Fix human attribute_name to handle deeply nested attributes
2012-05-29 23:26:26 -07:00
Steve Purcell
b3ccd7b27a
Don't enable validations when passing false hash values to ActiveModel.validates
...
Passing a falsey option value for a validator currently causes that validator to
be enabled, just like "true":
ActiveModel.validates :foo, :presence => false
This is rather counterintuitive, and makes it inconvenient to wrap `validates` in
methods which may conditionally enable different validators.
As an example, one is currently forced to write:
def has_slug(source_field, options={:unique => true})
slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? }
before_validation slugger
validations = { :presence => true, :slug => true }
if options[:unique]
validations[:uniqueness] = true
end
validates :slug, validations
end
because the following reasonable-looking alternative fails to work as expected:
def has_slug(source_field, options={:unique => true})
slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? }
before_validation slugger
validates :slug, :presence => true, :slug => true, :uniqueness => options[:unique]
end
(This commit includes a test, and all activemodel and activerecord tests pass as before.)
2012-05-28 15:02:02 +01:00
Vijay Dev
575e77ba16
Merge branch 'master' of github.com:lifo/docrails
2012-05-26 17:49:59 +05:30
Edward Tsech
b98a343da5
Add comment for attr_accessible/attr_protected :as option. [ci skip]
2012-05-25 16:35:53 +02:00
José Valim
56417b4092
Merge pull request #4785 from ayamomiji/add-self-to-allow-method-name-using-ruby-keyword
...
add `self.` to allow method name using ruby keyword
2012-05-25 00:29:07 -07:00
Matt Griffin
6c7b250ac0
Add license field to gemspecs, by Matt Griffin
2012-05-23 09:22:25 -07:00
Angelo capilleri
5646d65d01
changed xml type datetime to dateTime, fixes #6328
...
XmlMini define the xml 'datatime', but according to
http://www.w3.org/TR/xmlschema-2/#dateTime could be better
change this to 'dateTime' with upper case letter 'T.
So 'DateTime' and 'Time' are redefined from 'datetime' to 'dateTime'
add the changing to the changelog
2012-05-23 14:45:56 +02:00
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
f021377358
Updated tests for has_secure_password.
2012-05-08 18:08:55 -05: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
700dd0014b
Revert "fixing active model links in readme"
...
This reverts commit c962680e1902d2c9474f0be8ba7b0b8ab361cae6.
Reason: The links must be relative to work in both edge and stable api
sites.
2012-05-07 20:43:04 +05:30
Francesco Rodriguez
ae0a4ca2e1
removing the surrounding +s in active model readme
2012-05-07 09:49:54 -05:00
Francesco Rodriguez
204a79fe61
fixing marked actived model classes in readme
2012-05-07 00:48:19 -05:00
Francesco Rodriguez
79f1daf2ce
marking some active model classes
2012-05-07 00:45:54 -05:00
Francesco Rodriguez
c962680e19
fixing active model links in readme
2012-05-07 00:40:00 -05:00
Francesco Rodriguez
9f3637fad5
adding observer example
2012-05-07 00:33:26 -05:00
Vijay Dev
3d9673d8f6
Merge branch 'master' of github.com:lifo/docrails
2012-05-04 17:51:15 +05:30
Alexey Vakhov
616de66c55
Fix ActiveModel README example
2012-05-04 12:32:35 +04:00
Roman V. Babenko
84feca4aaa
Rakefile executable attributes and shebang lines has been removed
2012-05-02 13:38:13 +03: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
Arun Agrawal
7f248076a3
build fix for observing_test.rb
...
introduced here 17c990b153f8635874c006a7460ee95817543fc1
2012-04-30 15:27:18 +05:30
Santiago Pastorino
4cff1a2809
Merge pull request #6072 from marcandre/observer_simplify_test
...
Observer: simplify tests
2012-04-30 00:15:51 -07: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
17c990b153
Observer: simplify tests
2012-04-29 22:02:02 -04: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
3a749a9bd1
Reordered changelog entry
2012-04-23 21:30:24 -04:00
Brian Cardarella
d32cbee2b3
Updated CHANGELOG
2012-04-23 21:04:10 -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
Bernard Kroes
be4a44f1f9
Fixed expected value in comment. Removed duplicate lines in example.
2012-04-21 22:16:38 +02: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
Vijay Dev
8248f4202d
Merge branch 'master' of github.com:lifo/docrails
2012-04-12 21:44:11 +05:30
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
Vijay Dev
02a5847d32
fix bad format [ci skip]
2012-04-11 22:37:17 +05:30
Jonathan Mazin
729890469d
Fix small markup error; fix incorrect link
2012-04-09 15:41:50 -03: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
Aaron Patterson
6289f455ae
test against ruby features in order to fix tests on Ruby 2.0
2012-03-26 11:32:21 -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
Prem Sichanugrist
f1637bf2bb
Remove Active Resource source files from the repository
...
Dear Active Resource,
It's not that I hate you or anything, but you didn't get much attention lately. There're so many alternatives out there, and I think people have made their choice to use them than you. I think it's time for you to have a big rest, peacefully in this Git repository.
I will miss you,
@sikachu.
2012-03-13 14:55:44 -04: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
José Valim
225eff9d61
Merge pull request #5351 from shanna/master
...
Missing active_model/naming.rb dependency.
2012-03-08 23:26:48 -08: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
Rafael Mendonça França
d804790634
Fix my name in the CHANGELOG to follow the convention
...
Also add missing entries and use the formating convention
2012-03-09 00:54:21 -03:00
Vijay Dev
db6542178c
changelog updates for Rails 4 [ci skip]
2012-03-09 02:22:17 +05:30
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
claudiob
05c6caf48c
Add release dates to documentation
...
Set "March 1, 2012" as the release date for 3.2.2, 3.1.4, 3.0.12
2012-03-01 11:20:03 -08:00
Paco Guzman
152a393d4f
Update changelogs with rails 3.0-stable branch info
2012-02-25 13:50:08 +01: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
Carlos Antonio da Silva
5bcb4e3c18
Cleanup extra spaces
2012-02-13 11:20:19 -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
Vijay Dev
e6c98b83cb
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
activerecord/lib/active_record/relation/query_methods.rb
2012-02-09 23:44:17 +05:30
prasath
848ee296ec
test title changed corresponding to the test
2012-02-09 02:11:36 +05:30
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
Carlos Antonio da Silva
9296996029
Fixes in AMo README
2012-02-07 20:29:14 -02:00
José Valim
91bb008c0b
Update README to mention lint.
2012-02-07 23:17:24 +01: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
José Valim
b41ef0a448
Merge pull request #4866 from bogdan/terminate_after_callbacks
...
AS::Callbacks#define_callbacks: add :terminate_after_callbacks option
2012-02-04 02:53:47 -08:00
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
Arun Agrawal
bfb84cfb3e
Verbose output for tests.
...
See #3892
2012-02-03 08:01:24 -05: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 Patterson
2fd9816851
Merge pull request #4709 from ask4prasath/refactor_validation_test
...
Removed unwanted intializer and replaced with ruby default collect method
2012-01-27 09:09:33 -08:00
Aaron Beckerman
9d119c5fee
fix example code in documentation for has_secure_password
2012-01-28 00:53:02 +11:00
prasath
f4d9ba0296
Removed unwanted intializer and replaced with ruby default collect method
2012-01-27 00:13:46 +05:30
claudiob
6d426b1035
Add release date of Rails 3.2.0 to documentation
2012-01-26 01:53:38 -08:00
Vijay Dev
203771da9e
Merge branch 'master' of github.com:lifo/docrails
2012-01-26 00:00:40 +05:30
Aaron Patterson
c421870c7a
Merge pull request #4644 from ask4prasath/refactor_test
...
Replaced unwanted method and added to accessor for getter history
2012-01-25 09:40:45 -08:00
Jonathan del Strother
73e71c27f2
Fix translate_error reference for Error#add documentation
2012-01-25 15:02:20 +00:00
prasath
bf31d7b224
Removing unwanted method and adding to accessor for getter history
2012-01-25 01:34:04 +05:30
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
Carlos Antonio da Silva
e5df4f9255
Fix test class name that should read Without
2012-01-16 00:00:57 +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
Aaron Patterson
fec6f1ba82
Merge pull request #4360 from rafaelfranca/patch-1
...
Remove more references to Test::Unit
2012-01-06 16:43:18 -08:00
Aaron Patterson
b15d2c0708
require minitest rather than test/unit
2012-01-06 15:50:47 -08:00
Rafael Mendonça França
3d4754f131
Use ActiveModel::TestCase instead of Test::Unit:TestCase
2012-01-06 20:43:08 -03:00
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
Vijay Dev
54e522a388
Merge branch 'master' of github.com:lifo/docrails
2011-12-25 19:33:33 +05:30