Commit Graph

5018 Commits

Author SHA1 Message Date
Jan Bernacki
510601ce8e short arrays in inspect 2013-10-30 08:47:54 +04:00
David Heinemeier Hansson
ab177d8cbe Fix broken delete_all test, which will now be failing since #delete_all is broken 2013-10-28 21:48:02 -07:00
David Heinemeier Hansson
e562ddedba Add failing test for preloading with a polymorphic association and using the existential predicate 2013-10-28 21:26:03 -07:00
Rafael Mendonça França
6fb056e3b6 Merge pull request #12578 from jeradphelps/configurable_schema_migrations_table_name
Configurable name for schema_migrations table

Conflicts:
	activerecord/CHANGELOG.md
2013-10-27 21:07:03 -02:00
Rafael Mendonça França
8a00866099 Assert the return value in the test 2013-10-27 18:11:00 -02:00
Paul Nikitochkin
6b71a1416c Skip include_values from through associations chains for building target scope
Fixes: #12242, #9517, #10240
2013-10-27 21:15:41 +02:00
Jerad Phelps
26638f0ac9 added schema_migrations_table_name to ActiveRecord::Base in order that the name of the schema migrations table can be configured.
consolidated test_schema_migrations_table_name tests

Added changelog entry

edited changelog

removed commented lines

removed reader

ensure the schema migrations table is reset at end of test

added entry to configuration guide

guides typo and changelog order
2013-10-27 08:50:35 -05:00
Yves Senn
dc8fac1cac Merge pull request #12643 from severin/pg_cast_json_on_write
cast json values on write to be consistent with reading from the db.
2013-10-25 08:17:40 -07:00
Severin Schoepke
c3606afb2a cast json values on write to be consistent with reading from the db.
See also commit 5ac2341fab689344991b2a4817bd2bc8b3edac9d
2013-10-25 17:05:42 +02:00
Yves Senn
0e918ea97a prevent time_zone_aware_attributes test leak. follow-up to #12633. 2013-10-25 17:05:41 +02:00
Yves Senn
a0599535aa only warn on leaked time zone state instead of rasing an error.
Raising `RuntimeErrors` skips important cleanup code and leads to
a lot of subsequent errors. This clutters the test output with a lot
of noise.
2013-10-25 15:59:04 +02:00
Yves Senn
2dc579baf4 Merge pull request #12633 from senny/no_more_time_zone_leaks
prevent global timezone state from leaking out of test cases.
2013-10-25 06:10:11 -07:00
Yves Senn
abe91cb3bf prevent global timezone state from leaking out of test cases. 2013-10-25 14:40:57 +02:00
Yves Senn
0492ea6d39 ActiveRecord::Store works together with PG hstore columns.
This is necessary because as of 5ac2341 `hstore` columns are always stored
as `Hash` with `String` keys. `ActiveRecord::Store` expected the attribute to
be an instance of `HashWithIndifferentAccess`, which led to the bug.
2013-10-25 08:35:35 +02:00
Yves Senn
bf43b4c33f stored_attributes need to be specific to a subclass.
Currently they are all stored globally in the same `Hash`.
This commit forces the creation of a per-class variable if necessary.

The behavior was exposed through the following test-case:

```
  1) Failure:
StoreTest#test_all_stored_attributes_are_returned [/Users/senny/Projects/rails/activerecord/test/cases/store_test.rb:151]:
--- expected
+++ actual
@@ -1 +1 @@
-[:color, :homepage, :favorite_food]
+[:resolution, :color, :homepage, :favorite_food]
```
2013-10-25 08:35:35 +02:00
Yves Senn
557b8b6947 test to verify the ActiveRecord::Store behavior with PG's json type 2013-10-25 08:34:59 +02:00
Rafael Mendonça França
7160ffbe59 Merge pull request #12621 from laurocaetano/fix_has_one_association_with_primary_key_set
Save association when primary key is manually set

Conflicts:
	activerecord/CHANGELOG.md
2013-10-24 22:37:29 -02:00
laurocaetano
8022fc4913 Save association when primary key is manually set 2013-10-24 22:30:30 -02:00
Rafael Mendonça França
5ad34a8d8d Fix order dependent tests 2013-10-22 11:35:33 -02:00
Aaron Patterson
8f5647e9c5 Merge branch 'master' into joindep
* master: (23 commits)
  Escape the parentheses in the default function regexp
  Update docs on Tilt::Template in Asset Pipeline guide
  Fix loading a sql structure file on postgres when the file's path has whitespace in it
  remove trailing whitespace added with b057765 [ci skip].
  Allow unscope to work with `where.not`
  Raise an exception when model without primary key calls .find_with_ids
  Process sub-query relation's binding values
  Instrument the generation of Action Mailer messages
  Remove extra variable creation and merge.
  In Relation#empty? use #exists? instead of #count.
  [ci skip] avoid deprecation warning in sample code
  Convert Fixnum into String the port number in MySQL
  Fix some indentation on autosave association
  Make define_non_cyclic_method simpler
  Add Sass gobbling info to asset pipeline docs
  Ensure the state is clean after one failure
  Fix typo in form_helper.rb
  add a new local variable to track if digests are being stored, to ensure the cleanup works correctly
  [ci skip] Fix number of methods added by association.
  update digestor code based on review
  ...
2013-10-21 14:59:14 -07:00
Rafael Mendonça França
b98c10c164 Merge pull request #12588 from jetthoughts/12586_subquery_with_unprepared_sql
Inline bind values for sub-queries generated for Relation in where

Conflicts:
	activerecord/CHANGELOG.md
2013-10-21 19:13:04 -02:00
Rafael Mendonça França
a595fc1c56 Escape the parentheses in the default function regexp
This is causing every default value in PostreSQL database to being
handled as default function.

Fixes #12581
2013-10-21 16:20:28 -02:00
Kevin Mook
a733e00b10 Fix loading a sql structure file on postgres when the file's path has whitespace in it 2013-10-21 13:30:05 -04:00
Yves Senn
19639c7184 remove trailing whitespace added with b057765 [ci skip]. 2013-10-21 17:25:25 +02:00
Eric Hankins
b057765817 Allow unscope to work with where.not
Allows you to call #unscope on a relation with negative equality operators,
i.e. Arel::Nodes::NotIn and Arel::Nodes::NotEqual that have been generated
through the use of where.not.
2013-10-21 09:43:57 -05:00
Shimpei Makimoto
e2419a451a Raise an exception when model without primary key calls .find_with_ids 2013-10-21 17:07:47 +09:00
Paul Nikitochkin
a2ed5d2381 Process sub-query relation's binding values
Generated sub-query for Relation as array condition for `where` method
did not take in account its bind values, in result generates invalid SQL query.

Fixed by adding sub-query relation's binding values to base relation

Closes: #12586
2013-10-20 21:07:07 +03:00
Kenta Okamoto
bc5148da3d Convert Fixnum into String the port number in MySQL 2013-10-18 21:56:59 +09:00
Aaron Patterson
5c7633cd30 Merge branch 'master' into joindep
* master:
  use the cached arel table
  Fix typo in the changelog entry
  Don't remove the select values to add they back again
  Pluck on NullRelation accepts a list of columns

Conflicts:
	activerecord/lib/active_record/relation/finder_methods.rb
2013-10-15 14:54:31 -07:00
Aaron Patterson
ee46f1d5d2 Merge branch 'master' into joindep
* master: (44 commits)
  grammar fix (reverted in e9a1ecd)
  Revert "fixed a doc bug in the CHANGELOG.md s/does no longer depend on/no longer depends on/"
  Add missed require making `enable_warnings` available
  Prepare generated Gemfile for Capistrano 3
  Added --model-name option scaffold_controller_generator.
  read the association instead of sending
  we should have unique sponsorable ids in the fixtures at least
  simplify populating the ordering hash
  the preloader for the RHS has all the preloaded records, so ask it
  only calculate offset index once. #12537
  Remove size alias for length validation
  Fix `singleton_class?`
  Minor Refactoring to `NumberHelper#number_to_human`
  `$SAFE = 4;` has been removed with Ruby 2.1
  scope_chain should not be mutated for other reflections
  Remove `default_primary_key_type`  and extract contains of `native_database_types` to a constant since they aren't conditional now in SQLite3Adapter. Makes it more like other adapters.
  cleanup changelog entry format. [ci skip]
  Extract a function to determine if the default value is a function
  Push default_function to superclass to avoid method check
  Dump the default function when the primary key is uuid
  ...

Conflicts:
	activerecord/lib/active_record/relation/finder_methods.rb
2013-10-15 14:45:00 -07:00
Derek Prior
23dfc39ed9 Pluck on NullRelation accepts a list of columns
`pluck` was updated to accept a list of columns, but the `NullRelation`
was never updated to match that signature. As a result, calling `pluck`
on a `NullRelation` results in an `ArgumentError`.
2013-10-15 13:11:43 -04:00
Aaron Patterson
3d7efb1627 this method does not exist anymore 2013-10-14 18:45:47 -07:00
Aaron Patterson
e95bc57208 we should have unique sponsorable ids in the fixtures at least 2013-10-14 15:27:49 -07:00
Neeraj Singh
cd9592959f scope_chain should not be mutated for other reflections
Currently `scope_chain` uses same array for building different
`scope_chain` for different associations. During processing
these arrays are sometimes mutated and because of in-place
mutation the changed `scope_chain` impacts other reflections.

Fix is to dup the value before adding to the `scope_chain`.

Fixes #3882.
2013-10-14 11:59:59 -04:00
Rafael Mendonça França
25649c7fd7 Merge pull request #9499 from dmitry/inverse_instance_should_not_be_reloaded_after_stale_state_change
Inversed instance should not be reloaded after stale state was changed

Conflicts:
	activerecord/CHANGELOG.md
2013-10-14 12:17:40 -03:00
Rafael Mendonça França
c05f9558ee Merge pull request #11833 from vipulnsward/remove_autoincrement
Remove sqlite specific`supports_autoincrement?` which defaults to true
2013-10-14 07:48:45 -07:00
Rafael Mendonça França
9541a72858 Dump the default function when the primary key is uuid
Fixes #12489
2013-10-14 01:46:35 -03:00
Dmitry Polushkin
05b178085a inversed instance should not be reloaded after stale state was changed
check at association reader that record is inverted and should not be reloaded because of stale was changed at target record
2013-10-13 21:51:40 +01:00
Rafael Mendonça França
dcff027a52 Merge pull request #12518 from vipulnsward/remove_count_options
`Relation#count` doesn't use options anymore.
2013-10-13 12:56:47 -07:00
Rafael Mendonça França
95cb54a29e Merge pull request #12508 from jetthoughts/12415_generate_subqueries_for_relation_from_binding_params
Generate subquery for Relation passed as array condition for where

Conflicts:
	activerecord/CHANGELOG.md
2013-10-13 16:45:30 -03:00
Paul Nikitochkin
bc293ff690 Generate subquery for Relation passed as array condition for where
Instead of executing 2 queries for fetching records filtered by array condition with Relation,
added generation of subquery to current query.

This behaviour will be consistent when passes Relation as hash condition to where

Closes: #12415
2013-10-13 22:13:50 +03:00
Rafael Mendonça França
0b2884a8ae Merge pull request #12456 from razielgn/ar-test-fixes
Fixed MRI dependent stuff in AR tests
2013-10-13 12:09:12 -07:00
Vipul A M
42d3d3c217 Stop accepting options for Relation#average, Relation#minimum, Relation#maximum, Relation#calculate, perform_calculation, NullRelation#calculate as they isn't used anymore. 2013-10-14 00:04:10 +05:30
Rafael Mendonça França
0df9149fd6 Merge pull request #11791 from versioncontrol/includes_with_persistent_select
Includes with persistent select, fixes #11773
2013-10-12 21:17:26 -07:00
Rafael Mendonça França
ebe9cd8e61 Merge branch 'builder-instances' 2013-10-09 20:59:45 -03:00
Arun Agrawal
91fe499275 Using flat_map instead of map and flatten
original commit 8998441967a8cfc6e4302c29664ab9d0acd77704

Reverted here ec8ef1e1055c4e1598da13f49d30261f07f4a9b4
2013-10-09 14:38:44 +02:00
Rafael Mendonça França
0ee7331c35 Define the association extensions without need to have a builder
instance
2013-10-09 00:48:56 -03:00
Edo Balvers
7cab255a97 Fixes #11773 when using includes combined with select, the select statement was overwritten. 2013-10-08 16:41:53 +02:00
Federico Ravasio
0aeb11e575 Allow methods arity below -1 in assert_responds.
Every method from MRI's core classes is written in C. This means
Method#arity always returns -1 for methods with a variable number of
arguments. This is not the case with Rubinius, where, for example
Array#slice! is implemented in Ruby and has arity -2, since is
defined as def slice!(start, length = undefined)
2013-10-08 00:15:11 +02:00
Federico Ravasio
d8537ef1ec Assert presence of "frozen" in error message, not the full MRI message.
Related to all the other issues regarding message independent assertions
to make Rails compatible with other Ruby implementations other than MRI.

The best way here would be to have a specific error raised when modifying
frozen objects, like FrozenObjectError or something. But since Ruby
doesn't provide such a thing, we must limit the assertion to the lowest
common denominator, which is word "frozen".
2013-10-08 00:15:07 +02:00