Commit Graph

10876 Commits

Author SHA1 Message Date
Richard Schneeman
fdb67ebd62 Merge pull request #13417 from TalkativeTree/comments_change
fix CollectionAssociation's comments
2013-12-19 18:53:22 -08:00
Ben Angel
855ded6679 change CollectionAssociation's comments to say Association instead of AssociationProxy to match changes for 3.1 removing Association proxy. 2013-12-19 18:35:24 -08:00
Rafael Mendonça França
ccaa3e47c4 Merge pull request #13412 from arthurnn/quote_id_not_id
quoting: Check if id is a valid method before using it
2013-12-19 13:57:14 -08:00
Rafael Mendonça França
cf15e027b9 Improve CHANGELOG entry [ci skip] 2013-12-19 19:53:26 -02:00
Arthur Neves
4a720a2cde quoting: Check if id is a valid method before using it
Need to check if valud also respond_to :id before calling it, otherwise
things could explode.
2013-12-19 16:51:28 -05:00
Cody Cutrer
847e9a95da fix default select when from is used 2013-12-19 14:40:13 -07:00
Carlos Antonio da Silva
e4cde5d58c Fix indent in PG array tests
[ci skip]
2013-12-19 19:14:23 -02:00
Vijay Dev
a3b1105ada Merge branch 'master' of github.com:lifo/docrails 2013-12-20 00:10:30 +05:30
Carlos Antonio da Silva
cc1f0b4c2d Merge pull request #13395 from kuldeepaggarwal/postgres-table-ref-regex
modified regex for finding table_name from a multiline sql query in postgresql
2013-12-19 05:22:28 -08:00
Kuldeep Aggarwal
b082bece5e Fix PostgreSQL insert to properly extract table name from multiline string SQL.
Previously, executing an insert SQL in PostgreSQL with a command like this:

    insert into articles(
      number)
    values(
      5152
    )

would not work because the adapter was unable to extract the correct articles table name.
2013-12-19 18:46:17 +05:30
Carlos Antonio da Silva
c5b76b5362 Prefer assert_raise instead of flunk + rescue to test for exceptions
Change most tests to make use of assert_raise returning the raised
exception rather than relying on a combination of flunk + rescue to
check for exception types/messages.
2013-12-19 09:20:51 -02:00
Carlos Antonio da Silva
5b0fc1a007 Merge pull request #13393 from matthewd/fix_pg_range_tests
Fix PostgreSQL range tests on fresh DB

Correcting the name of the table we're creating is self-explanatory.

But we must also move away from the low IDs, because we're not touching the freshly-created primary key sequence; when the time comes, @new_range will be assigned an ID of 1.
2013-12-19 01:44:01 -08:00
Guillermo Iguaran
86dcb55588 Merge pull request #13400 from nishant-cyro/docs
fix typos and grammar mistake [ci skip]
2013-12-18 22:33:49 -08:00
nishant-cyro
517caa85c9 fix typos and grammar mistake [ci skip] 2013-12-19 12:02:01 +05:30
Guillermo Iguaran
947efd4869 Merge pull request #13398 from kuldeepaggarwal/build-fixes
set encoding UTF-8 for accepting multibyte character
2013-12-18 22:23:22 -08:00
Alex Ghiculescu
ed768ee5c1 Fix typo: data --> date 2013-12-19 16:13:18 +10:00
Kuldeep Aggarwal
ff4673be52 set encoding UTF-8 for accepting multibyte character 2013-12-19 11:00:38 +05:30
Godfrey Chan
e63748cd37 Merge pull request #13366 from vipulnsward/minitest-namespace-change
Change all `MiniTest` to `Minitest`
2013-12-18 19:22:30 -08:00
Matthew Draper
f8b4110f00 Fix PostgreSQL range tests
The changes in c4044b2 meant the tests would error on a fresh DB.
2013-12-19 13:34:46 +10:30
rono23
ee738f9604 Fix to_param when attribute has multibyte character 2013-12-19 05:29:16 +09:00
Jeremy Kemper
01162b3d77 Fix nil assignment to polymorphic belongs_to
Assigning nil to a polymorphic belongs_to would nullify its _id field by
not its _type field.

Fixes failing test from c141dfc838a5dca9f197814410fa5d44c143129c.
Regression from 1678e959e973de32287b65c52ebc6cce87148951.
2013-12-18 04:52:24 -07:00
Vipul A M
7bae2921ec Change all MiniTest to Minitest since, MiniTest namespace has been renamed to Minitest
Ref: https://github.com/seattlerb/minitest/blob/master/History.txt
2013-12-18 14:39:50 +05:30
Godfrey Chan
2c9cb495f3 Merge pull request #13340 from akshay-vishnoi/typo
#none documentation updated [ci skip]
2013-12-18 00:02:48 -08:00
Akshay Vishnoi
db765ec741 #none documentation updated [ci skip] 2013-12-18 11:52:54 +05:30
Jeremy Kemper
c141dfc838 Add a failing test for assigning nil to a polymorphic belongs_to not nullifying its _type column 2013-12-17 21:45:55 -07:00
David Heinemeier Hansson
c0a2d474c5 Get ready to release 4.1.0.beta1 2013-12-17 16:05:28 -08:00
Jeremy Kemper
2b096c7170 Merge pull request #13314 from laurocaetano/blacklist_array_methods
Create a blacklist to disallow mutator methods to be delegated to Array

Conflicts:
	guides/source/upgrading_ruby_on_rails.md
2013-12-17 11:29:23 -07:00
Carlos Antonio da Silva
ae196e85ee Merge pull request #13341 from carlosantoniodasilva/ca-i18n
Default I18n.enforce_available_locales to true

We will default this option to true from now on to ensure users properly handle their list of available locales whenever necessary. This option was added as a security measure and thus Rails will follow it defaulting to secure option.

Also improve the handling of I18n config options in its railtie, taking the new enforce_available_locales option into account, by setting it as the last one in the process. This ensures no other configuration will trigger a deprecation warning due to that setting.
2013-12-17 08:22:26 -08:00
Lauro Caetano
d4ee09cda1 Create a blacklist to disallow mutator methods to be delegated to Array.
This change was necessary because the whitelist wouldn't work.
It would be painful for users trying to update their applications.

This blacklist intent to prevent odd bugs and confusion in code that call mutator
methods directely on the `Relation`.
2013-12-17 13:43:10 -02:00
Rafael Mendonça França
c56bbaaf6f Merge pull request #13343 from akshay-vishnoi/test-cases
test case for #limit added - picking latest value from limit
2013-12-17 06:23:05 -08:00
Carlos Antonio da Silva
6802196a6b Disable available locales checks to avoid warnings running the tests 2013-12-17 09:05:41 -02:00
Jeremy Kemper
c28d0f2031 MySQL: remove the old-school 'packets out of order' message
Blast from the past, MySQL 4 era, when the password hashing style changed.
2013-12-17 01:56:42 -07:00
Akshay Vishnoi
687cd75fb5 test case for #limit added - picking latest value from limit 2013-12-17 03:50:34 +05:30
Martin Emde
8062a30794 Better support for where() conditions that use an association name.
Using the name of an association in `where` previously worked only
if the value was a single `ActiveRecrd::Base` object. e.g.

    Post.where(author: Author.first)

Any other values, including `nil`, would cause invalid SQL to be
generated. This change supports arguments in the `where` query
conditions where the key is a `belongs_to` association name and the
value is `nil`, an `Array` of `ActiveRecord::Base` objects, or an
`ActiveRecord::Relation` object.

    # Given the Post model
    class Post < ActiveRecord::Base
      belongs_to :author
    end

    # nil value finds records where the association is not set
    Post.where(author: nil)
    # SELECT "posts".* FROM "posts" WHERE "posts"."author_id" IS NULL

    # Array values find records where the association foreign key
    # matches the ids of the passed ActiveRecord models, resulting
    # in the same query as Post.where(author_id: [1,2])
    authors_array = [Author.find(1), Author.find(2)]
    Post.where(author: authors_array)

    # ActiveRecord::Relation values find records using the same
    # query as Post.where(author_id: Author.where(last_name: "Emde"))
    Post.where(author: Author.where(last_name: "Emde"))

Polymorphic `belongs_to` associations will continue to be handled
appropriately, with the polymorphic `association_type` field added
to the query to match the base class of the value. This feature
previously only worked when the value was a single `ActveRecord::Base`.

    class Post < ActiveRecord::Base
      belongs_to :author, polymorphic: true
    end

    Post.where(author: Author.where(last_name: "Emde"))
    # Generates a query similar to:
    Post.where(author_id: Author.where(last_name: "Emde"), author_type: "Author")
2013-12-16 14:16:15 -08:00
Carlos Antonio da Silva
4b4aeabb36 Fix missing closing rdoc tag [ci skip] 2013-12-16 11:14:54 -02:00
Rafael Mendonça França
108171a44e Merge pull request #13307 from akshay-vishnoi/typo
Spelling and Grammar check [ci skip]
2013-12-15 11:19:44 -08:00
Akshay Vishnoi
c758093eca Spelling and Grammar check [ci skip] 2013-12-16 00:44:37 +05:30
Rafael Mendonça França
89c46aaaab Improve CHANGELOG entry with examples [ci skip] 2013-12-15 17:07:44 -02:00
Rafael Mendonça França
a09659d59d Merge pull request #13313 from ccutrer/temp-tables
support creating temporary tables from queries

Conflicts:
	activerecord/CHANGELOG.md
2013-12-15 17:07:31 -02:00
Rafael Mendonça França
d150387a38 Improve the CHANGELOG entry [ci skip] 2013-12-15 16:46:12 -02:00
Arthur Neves
b3a806b7b2 db:test:clone and prepare must load environment
db:test:clone and db:test:prepare use
ActiveRecord::Base. configurations, so we need to load the rails
environment, otherwise the config wont be in place.
2013-12-14 17:33:50 -05:00
Cody Cutrer
75a2e4a8df support creating temporary tables from queries
also override drop_table in AbstractMySQLAdapter to properly drop
temporary tables without committing the transaction
2013-12-14 07:07:10 -07:00
Arun Agrawal
c2f1796c6d argument prefix warning removed
* interpreted as a argument prefix
2013-12-13 17:19:20 +01:00
Rafael Mendonça França
1713e8fe16 Merge pull request #13306 from kassio/master
Fix mysql to support duplicated column names
2013-12-13 05:55:54 -08:00
Kassio Borges
b8569b9337 Fix mysql to support duplicated column names
This will fix the [broken
test](4a26508366)
 `test_with_limiting_with_custom_select`.

The query's result was built in a hash with column name as key, if the
result have a duplicated column name the last value was
overriding the first one.
2013-12-13 11:55:13 -02:00
Yves Senn
63f9a7507b refactor, reuse assertions in range_test.rb. 2013-12-13 14:28:13 +01:00
Yves Senn
c4044b2f8a extract PG range tests from datatype_test.rb into range_test.rb 2013-12-13 14:17:21 +01:00
Jeremy Kemper
0b142a6f84 Add a bunch of Relation -> Array delegate methods to the whitelist. This won't last - aim to switch back to a blacklist for mutator methods. 2013-12-12 21:10:03 -07:00
Rafael Mendonça França
81433addc2 Merge pull request #12590 from laurocaetano/whitelist-to-delegate-array-methods
Create a whitelist of methods to be delegated to Array.
2013-12-12 14:42:39 -08:00
Aaron Patterson
94cd08be38 extract cache counter logic to one method 2013-12-12 14:33:02 -08:00