Commit Graph

1224 Commits

Author SHA1 Message Date
Guillermo Iguaran
8aebe30ef4 Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by"
This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing
changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1.
2013-01-18 09:15:19 -05:00
robertomiranda
7baecc4802 User Rails 4 find_by 2013-01-18 07:56:05 -05:00
Carlos Antonio da Silva
203f787321 Merge pull request #8940 from adomokos/adding_tests_for_changed_attributes
Cleaning up ActiveModel::Dirty tests
2013-01-15 13:02:57 -08:00
Attila Domokos
63333e600f Cleaning up ActiveModel::Dirty tests
* Clarifying what the #changed method returns
* Adding tests to describe what the #changed_attributes returns
* Updating test name based on pull request comment
* Moving the test lower in the file per pull request comment
2013-01-15 10:24:57 -05:00
Trung Lê
86c4fe8191 ActiveRecord <-> Active Record [ci skip] 2013-01-15 10:52:02 +00:00
Yves Senn
bc19c0d09c test for ActiveModel::Conversion#to_partial_path and namespaced models 2013-01-14 21:17:22 +01:00
Attila Domokos
01434a5ee6 Adding tests for ActiveModel::Model
* Verifying persisted? is false when Model initialized
* Passing nil to Model should not blow up
* Changing test name to the one suggested in pull request comment
2013-01-12 20:04:24 -05:00
Attila Domokos
7171f9cc8f Covering untested methods for ActiveModel::Errors 2013-01-10 21:41:35 -05:00
Irio Irineu Musskopf Junior
d4f46ee4fd Set default value to ActiveModel::Validator initializer attribute
Makes it easier to test its objects.
2013-01-09 13:50:27 -02:00
Vijay Dev
f049016cd3 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/getting_started.md
2013-01-09 01:04:15 +05:30
Gosha Arinich
0acf92184d prefer american spelling of 'behavior' 2013-01-07 11:47:27 +03:00
Akira Matsuda
3c21237c37 Reduce number of Strings a bit 2013-01-07 07:37:23 +09:00
Akira Matsuda
c8e632bd9f Namespace HashWithIndifferentAccess 2013-01-07 07:37:23 +09:00
Akira Matsuda
7f495993bb Observers was extracted from Active Model as rails-observers gem 2013-01-02 06:23:12 +09:00
Andrew Nesbitt
d814284506 Updated copyright notices for 2013 2012-12-31 20:35:29 +00:00
Rafael Mendonça França
5da4d5142a Add active_support/testing/autorun
minitest/autorun load minitest/spec polluting the global namespace with
the DSL that we don't want on Rails
2012-12-31 13:57:24 -03:00
Rafael Mendonça França
b05819fd28 This change doesn't need a CHANGELOG entry.
[ci skip]
2012-12-26 20:39:32 -03:00
Rafael Mendonça França
9647d4b6f4 Add CHANGELOG entry for #8622 2012-12-26 19:22:38 -03:00
Rafael Mendonça França
78fd14c8de Revert the change at ActiveModel::Errors#add_on_blank and fix in the
right place.

The EachValidator#validate already handle :allow_blank and :allow_nil,
correctly.

Closes #8622.

Fix #8621.
2012-12-26 18:55:47 -03:00
Colin Kelley
d4c30a0226 Tests and fix for validates_presence of :allow_nil, :allow_blank
Conflicts:
	activemodel/lib/active_model/errors.rb
2012-12-26 18:19:27 -03:00
Akira Matsuda
08cf17d708 chmod -x from non-script files 2012-12-24 23:36:19 +09:00
Rafael Mendonça França
bda1937f28 Remove CHANGELOG entry for ActiveModel::Errors#add_on_present 2012-12-21 17:10:41 -03:00
Rafael Mendonça França
ac6941fb71 Use :present as key for the absence validatior message 2012-12-21 17:10:16 -03:00
Rafael Mendonça França
b437053b5b Remove ActiveModel::Errors#add_on_present method.
We don't need to define a new method in ActiveMode::Errors for each
validatior.

See
d72a07f1d1 (commitcomment-2325333)
2012-12-21 17:06:18 -03:00
Carlos Antonio da Silva
42b555dcf3 Fix Action Mailer changelog indenation to match other changelogs
Also some minor improvements to other changelogs. [ci skip]
2012-12-19 23:09:04 -02:00
Carlos Antonio da Silva
05b80a1cce Improve AMo changelog example to not rely on AR [ci skip] 2012-12-19 23:03:32 -02:00
Roberto Vasquez Angel
d72a07f1d1 Add ActiveModel::Validations::AbsenceValidator, a validator to check the absence of attributes.
Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
2012-12-15 16:27:44 -05:00
Carlos Antonio da Silva
df9f9b7f3e Convert changelogs to 1.9 hash style and fix some formatting [ci skip] 2012-12-14 20:25:22 -02:00
Aaron Patterson
49219293e5 Merge pull request #8510 from thedarkone/thread_safety_improvements
Thread safety improvements
2012-12-14 11:12:50 -08:00
thedarkone
45448a5788 Replace some global Hash usages with the new thread safe cache.
Summary of the changes:
 * Add thread_safe gem.
 * Use thread safe cache for digestor caching.
 * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation.
 * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache.
 * Use TS::Cache to avoid the synchronisation overhead on listener retrieval.
 * Replace synchronisation with TS::Cache usage.
 * Use a preallocated array for performance/memory reasons.
 * Update the controllers cache to the new AS::Dependencies::ClassCache API.
   The original @controllers cache no longer makes much sense after @tenderlove's
   changes in 7b6bfe84f3 and f345e2380c.
 * Use TS::Cache in the connection pool to avoid locking overhead.
 * Use TS::Cache in ConnectionHandler.
2012-12-14 12:18:47 +01:00
Andrew White
4dd5635922 Only call in_time_zone on Time or DateTime instances
Both String and Date now respond to in_time_zone so we need to
check if the value is a Time or a DateTime.
2012-12-11 12:35:30 +00:00
Jeremy Kemper
8110035623 Revert "Omit directories from gemspec.files for RubyGems 2 compat."
Obviated by rubygems/rubygems@486ed83cc8

This reverts commit bb8923dee093b615615cdfb83b34d1b0bb254f25.
2012-12-09 17:14:27 -07:00
Jeremy Kemper
bb8923dee0 Omit directories from gemspec.files for RubyGems 2 compat.
RG2 packager expects each spec.files path to be a file and bombs when it tries to tarball a dir.

May revert if rubygems/rubygems#413 is accepted.
2012-12-08 17:18:46 -07:00
claudiob
019df98875 Replace comments' non-breaking spaces with spaces
Sometimes, on Mac OS X, programmers accidentally press Option+Space
rather than just Space and don’t see the difference. The problem is
that Option+Space writes a non-breaking space (0XA0) rather than a
normal space (0x20).

This commit removes all the non-breaking spaces inadvertently
introduced in the comments of the code.
2012-12-04 22:11:54 -08:00
Renato Mascarenhas
cc62ec1e8c Actually test that ActiveModel::Errors#add defaults to :invalid. 2012-12-01 22:30:34 -02:00
Renato Mascarenhas
703b6387ee Call full_messages instead of to_a in its spec. 2012-12-01 22:30:33 -02:00
Renato Mascarenhas
cf7ab6056a Reset attributes should not report changes.
When resetting an attribute, you expect it to return to the state it was
before any changes. Namely, this fixes this unexpected behavior:

~~~ruby
model.name = "Bob"
model.reset_name!
model.name_changed? #=> true
~~~
2012-12-01 16:58:09 -02:00
Carlos Antonio da Silva
c2be9b0c3e Simplify keys order test for as_json in Active Model 2012-11-30 10:21:24 -02:00
Rafael Mendonça França
ec17f0d352 Add CHANGELOG entries for the observes extraction
[ci skip]
2012-11-29 01:08:36 -02:00
Rafael Mendonça França
ccecab3ba9 Remove observers and sweepers
They was extracted from a plugin.

See https://github.com/rails/rails-observers

[Rafael Mendonça França + Steve Klabnik]
2012-11-28 22:46:49 -02:00
Steve Klabnik
9504b44cf6 Specify type of singular association during serialization
When serialising a class, specify the type of any singular associations, if
necessary. Rails already correctly specifies the :type of any enumerable
association (e.g. a has_many association), but made no attempt to do so for
non-enumerables (e.g. a has_one association).
We must specify the :type of any STI association. A has_one
association to a class which uses single-table inheritance is an example of
this type of association.

Fixes #7471
2012-11-28 11:48:32 -08:00
Rafael Mendonça França
5658923daa Merge pull request #7282 from xHire/validates_length_of_fix
Length validation handles correctly nil. Fix #7180

Conflicts:
	activemodel/CHANGELOG.md
2012-11-26 18:44:07 -02:00
Carlos Antonio da Silva
26a3b70cc4 Merge pull request #8320 from senny/active_model_log_folder
Log output from activemodel's railtie_test directly to STDOUT.

There's no logging going on here, but since we initialize the app, the
logger is set and the folder is automatically created. With this change,
the default logger is not created, so there is no logging folder anymore.

Conflicts:
	activemodel/test/cases/railtie_test.rb
2012-11-26 15:32:25 -02:00
Yves Senn
6fc83201db log output from activemodel's railtie_test directly to STDOUT
after this patch, running the tests in activemodel will no longer
create an untracked log/ folder inside of activemodel
2012-11-26 17:23:20 +01:00
Rafael Mendonça França
3ec443086b Merge pull request #8312 from senny/make_active_model_parts_individually_loadable
make sure that individual parts `ActiveModel` can be required by itself
2012-11-26 04:11:17 -08:00
Michal Zima
ea76e9a312 Length validation handles correctly nil. Fix #7180
When nil or empty string are not allowed, they are not valid.
2012-11-26 12:34:32 +01:00
Carlos Antonio da Silva
3da1649828 Require active_model/railtie directly instead of rails/all
Use Class.new with a block instead of tap to configure it.
2012-11-26 09:19:57 -02:00
Yves Senn
22598ee599 cleanup, removed dispensable require statements from ActiveModel 2012-11-25 17:08:57 +01:00
Yves Senn
b7edbc718b cleanup, remove broken whitespace 2012-11-25 16:57:29 +01:00
Carlos Antonio da Silva
c2c1ecb05e Use secure password min cost option in its own tests for a speed up
Around 0.564359s => 0.092244s speed up in my machine.
2012-11-21 19:34:55 -02:00