Commit Graph

827 Commits

Author SHA1 Message Date
Robby Grossman
ad7f9cdf00 has_secure_password should not raise a 'digest missing' error if the calling class has specified for validations to be skipped. 2012-07-31 16:16:21 -04:00
Jon Leighton
6a81ccd69d ActiveRecord::Base.all returns a Relation.
Previously it returned an Array.

If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This
is more explicit.

In most cases this should not break existing code, since
Relations use method_missing to delegate unknown methods to #to_a
anyway.
2012-07-27 13:34:12 +01:00
Rafael Mendonça França
a63f7a1364 Update documentation and change the range method name to delimiter. 2012-07-20 14:23:05 -03:00
Rafael Mendonça França
770fa81bba Don't pass :within option to the i18n 2012-07-20 14:10:25 -03:00
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
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