1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

12887 commits

Author SHA1 Message Date
Caleb Thompson
382a70c875
Remove environment dependency for db:schema:load
All of the behavior :environment was giving (that db:schema:load needed)
was provided as well with :load_config.

This will address an issue introduced in
https://github.com/rails/rails/pull/15394. The fact that db:schema:load
now drops and creates the database causes the Octopus gem to have [an
issue](https://github.com/tchandy/octopus/issues/273) during the drop
step for the test database (which wasn't happening in db:schema:load
before). The error looks like:

    ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR:  cannot drop the currently open database
    : DROP DATABASE IF EXISTS "app_test"

Because of the timing, this issue is present in master, 4-2-*, and
4.1.8.

A note to forlorn developers who might see this: "Additionally" in a
commit message means you should have a separate commit, with a separate
justification for changes. Small commits with big messages are your
friends.
2014-12-04 14:11:02 -07:00
Rafael Mendonça França
28beb286b3 Merge pull request from kamipo/prevent_symbol_gc
Prevent Symbol GC
2014-12-04 13:26:27 -02:00
Yves Senn
9e0dab64d8 docs, bring back ActiveRecord::Core methods in the API. [ci skip]
This `# :nodoc:` had the effect of hiding every method that follows.
This meant that the API page for `ActiveRecord::Core` only contained
`configurations` and none of the following methods.

Furthermore this `# :nodoc:` had no effect on `maintain_test_schema`.
Those `mattr_accessor` inside the `included` block are not picked up
by rdoc.

/cc @zzak
2014-12-04 09:07:56 +01:00
Ryuta Kamizono
8dcfc5d081 Prevent Symbol GC 2014-12-04 11:47:22 +09:00
Isaac Seymour
db64f5d7eb Clarify that batching methods can be used with any orderable type primary key, not just integer ones, as per @a58cafeb3a86be46849de57481b6644094fb8165 2014-12-03 21:56:14 +00:00
Sean Griffin
b612df9a25 Merge pull request from mrgilman/move-predicate-builder-to-constructor
Move PredicateBuilder instantiation to constructor
2014-12-03 11:31:45 -07:00
Yves Senn
94e8fc0619 Active Record changelog needs to keep pointing at 4-2-stable.
[ci skp]
2014-12-03 19:29:26 +01:00
Yves Senn
3f78a57fd6 docs, add new changelog entries at the top 😓 [ci skip] 2014-12-03 19:27:13 +01:00
Yves Senn
2ee8c9c5b7 Merge pull request from CLUSTERfoo/fix/adding_timestamps_migration_not_reversible
Failure to rollback t.timestamps when within a change_table migration
2014-12-03 19:22:55 +01:00
Melanie Gilman
286ab9b606 Move PredicateBuilder instantiation to constructor
In order to maintain thread safety and prevent race condition from memoization.
2014-12-03 13:20:56 -05:00
noam
b64fb3020b Failure to rollback t.timestamps when within a change_table migration
When running the following migration:

    change_table(:table_name) { |t| t/timestamps }

The following error was produced:

    wrong number of arguments (2 for 1) .... /connection_adapters/abstract/schema_statements.rb:851:in `remove_timestamps'

This is due to `arguments` containing an empty hash as its second
argument.
2014-12-03 11:35:40 -05:00
Yves Senn
6613716ad7 document that .delete does work on #readonly? records. Closes
[ci skip]

This is due to the fact that `.delete` is directly translated to SQL.
It tries to follow the same rules as `.delete_all` which is not able
to verify that records are `#readonly?`.
2014-12-03 17:31:25 +01:00
Yves Senn
497544f0b3 skip test to get sqlite3_mem suite passing. 2014-12-03 11:38:37 +01:00
Yves Senn
19dfd2f8ed Merge pull request from sergey-alekseev/remove-useless-methods
remove useless methods
2014-12-03 08:25:40 +01:00
Sean Griffin
930d0853f4 Merge pull request from mxie/mx-fix-nonexistent-typo
Fix "nonexistent" typo in tests
2014-12-02 17:39:50 -07:00
Sergey Alekseev
44919e1cf0 remove useless methods 2014-12-03 03:20:55 +03:00
Melissa Xie
3b43d1d822 Fix "nonexistent" typo in tests 2014-12-02 19:19:10 -05:00
Sean Griffin
f987609ad6 Require missing association in test 2014-12-02 16:23:26 -07:00
Melanie Gilman
fcc3cbc71f Refactor build_from_hash to convert dot notation to hash first
This ensures that we're handling all forms of nested tables the same way.

We're aware that the `convert_dot_notation_to_hash` method will cause a
performance hit, and we intend to come back to it once we've refactored some of
the surrounding code.

[Melissa Xie & Melanie Gilman]
2014-12-02 15:49:16 -05:00
Sean Griffin
3317d6958c Merge pull request from mrgilman/refactor-predicate-builder
Refactor `PredicateBuilder` from singleton to instance
2014-12-02 11:45:12 -07:00
Melanie Gilman
502bc87fba Refactor PredicateBuilder from singleton to instance 2014-12-02 11:04:38 -05:00
deeeki
66b84c9f44 Allow to unscope where conditions using arel_table with Symbol
This commit fixes the following case.

    User.where(User.arel_table[:created_at].lteq(1.year.ago)).unscope(where :created_at)
2014-12-03 00:20:01 +09:00
Yves Senn
9e4ed2f996 no need to pass native_database_types around 2014-12-02 13:36:46 +01:00
Yves Senn
780269c732 pg tests, get rid of global schema schema_1. 2014-12-02 12:08:52 +01:00
Yves Senn
90e396ce65 pg tests, move uniqueness validation test to array tests. 2014-12-02 11:53:18 +01:00
Yves Senn
b8ec014b2d tests, extract pg number tests into separate file. 2014-12-02 11:46:08 +01:00
Yves Senn
af7c6e493c tests, move schema shorthand assertions into pg specific tests. 2014-12-02 11:35:53 +01:00
Yves Senn
bcf5b281a8 tests, move pg geometric tests out of base_test. 2014-12-02 11:00:19 +01:00
Aaron Patterson
e47b523fae ugh, forgot to add this test to cdd90f39d7 2014-12-01 11:46:57 -08:00
Yves Senn
bec9e83359 tests, favor public API over inspecting columns where possible.
This is a follow up to 07786c5e75
and cd2596f55e
2014-12-01 16:57:48 +01:00
Yves Senn
07786c5e75 tests, run numeric default tests for every adapter. 2014-12-01 16:26:40 +01:00
Yves Senn
cd2596f55e tests, use public API to verify default parsing. , 2014-12-01 16:07:57 +01:00
Guo Xiang Tan
0270363f5c Fix value extracted from negative integers for PostgreSQL.
Fixes: https://github.com/rails/rails/issues/17856.
2014-12-01 22:00:04 +08:00
Sean Griffin
704c658531 Ensure numericality validations work with mutation
The detection of in-place changes caused a weird unexpected issue with
numericality validations. That validator (out of necessity) works on the
`_before_type_cast` version of the attribute, since on an `:integer`
type column, a non-numeric string would type cast to 0.

However, strings are mutable, and we changed strings to ensure that the
post type cast version of the attribute was a different instance than
the before type cast version (so the mutation detection can work
properly).

Even though strings are the only mutable type for which a numericality
validation makes sense, special casing strings would feel like a strange
change to make here. Instead, we can make the assumption that for all
mutable types, we should work on the post-type-cast version of the
attribute, since all cases which would return 0 for non-numeric strings
are immutable.

Fixes 
2014-12-01 05:31:44 -07:00
Hendy Tanata
6874133f9e Fix grammar on ActiveRecord::AttributeMethods doc.
[ci skip]
2014-11-30 10:26:13 +00:00
Sean Griffin
a975407a0a Update Arel usage for rails/arel#98fc259
`where_sql` now requires that we pass it an engine. None of the manager
classes take an engine in their constructor.
2014-11-29 17:23:10 -07:00
Sean Griffin
de239066e3 Stop using Arel::Table.engine
We never actually make use of it on the table, since we're constructing
the select manager manually. It looks like if we ever actually were
grabbing it from the table, we're grossly misusing it since it's meant
to vary by AR class.

Its existence on `Arel::Table` appears to be purely for convenience
methods that are never used outside of tests. However, in production
code it just complicates construction of the tables on the rails side,
and the plan is to remove it from `Arel::Table` entirely. I'm not
convinced it needs to live on `SelectManager`, etc either.
2014-11-29 15:49:18 -07:00
Erik Michaels-Ober
d1374f99bf Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
claudiob
96d0f751f9 Bump required Ruby version to 2.1.0
[This article](http://weblog.rubyonrails.org/2014/8/20/Rails-4-2-beta1/#maintenance-consequences-and-rails-5-0) states that:

> Rails 5.0 is in most likelihood going to target Ruby 2.2.

Before the exact minimum version is fully decided, @arthurnn [suggests](https://github.com/rails/rails/pull/17830#issuecomment-64940383)
that **at least** version 2.1.0 **must** be required by the `gemspec` files.
2014-11-28 22:59:51 -08:00
Rafael Mendonça França
b2566429fe Merge pull request from kamipo/refactor_add_column_options
Refactor `add_column_options!`, to move the quoting of default value for :uuid in `quote_value`.
2014-11-28 17:13:30 -02:00
Rafael Mendonça França
f25ad07f5a Start Rails 5 development 🎉
We will support only Ruby >= 2.1.

But right now we don't accept pull requests with syntax changes to drop
support to Ruby 1.9.
2014-11-28 15:00:06 -02:00
Thorsten Ball
6405a03c13 Adds preloaded_records method to NullPreloader
This fixes a regression where preloading association throws an
exception if one of the associations in the preloading hash doesn't
exist for one record.

Fixes 
2014-11-28 13:42:50 +01:00
Rafael Mendonça França
2cdd229fc2 Merge pull request from yuki24/fix-bug-where-record-not-saved-loses-error-message
Fixed a bug where AR::RecordNotSaved loses the given error message
2014-11-28 10:29:03 -02:00
Yves Senn
f2d602b229 Merge pull request from kamipo/refactor_visit_add_column
Refactor `SchemaCreation#visit_AddColumn`
2014-11-28 11:13:26 +01:00
Ryuta Kamizono
66cc7ce67c Rename to quote_default_expression from quote_value 2014-11-28 17:30:55 +09:00
Ryuta Kamizono
91fca372b1 Refactor add_column_options!, to move the quoting of default value for :uuid in quote_value. 2014-11-28 11:21:08 +09:00
Yuki Nishijima
5142d54114 Fix a bug where AR::RecordNotSaved loses error messages
Since 3e30c5d, it started ignoring the given error message. This commit
changes the behavior of AR::RecordNotSaved#initialize so that it no
longer loses the given error message.
2014-11-27 17:56:12 -08:00
Rafael Mendonça França
200b9035da Merge pull request from jvperrin/correct-integer-test
Correct test description for large integer test
2014-11-27 21:16:55 -02:00
Rafael Mendonça França
8fc7eb5f21 Update the StatementCache documentation 2014-11-27 14:40:19 -02:00
Rafael Mendonça França
07f4bd5b60 StatementCache is private API
It should not be used in applications
2014-11-27 13:50:10 -02:00