aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix style issues with #16252Sean Griffin2015-10-292-12/+9
|
* making selected value to accept Hash like the default option. E.g. selected: ↵Lecky Lao2015-10-293-1/+33
| | | | | | | | {day: params[:day].to_i, month: params[:month].to_id} Adds in test test_date_select_with_selected_in_hash and change log fixes typo in CHANGELOG
* Revert "Revert "Merge pull request #22026 from ↵Yves Senn2015-10-293-0/+28
| | | | | | | | | akihiro17/fix-preload-association"" This reverts commit 5243946017d09afff4d70d273b0fcdfd41a4b22a. This fixes an issue with the build where tests would fail on mysql and postgresql due to different ordering.
* Merge pull request #22101 from gocardless/ar-pgbouncer-fixAndrew White2015-10-291-4/+5
|\ | | | | Avoid disabling postgres errors
| * Check standard_conforming_strings is not readonlyHarry Marr2015-10-291-1/+1
| | | | | | | | | | | | | | | | | | In Postgres 8.1 the standard_conforming_strings setting was read-only, meaning you got an error if you tried to update it. By filtering on `context = 'user'` we only try to update the setting if it's user-writable[1]. [1]: http://www.postgresql.org/docs/9.4/static/view-pg-settings.html
| * Avoid disabling postgres errorsHarry Marr2015-10-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The standard_conforming_strings setting doesn't exist on all versions of Postgres, but if it does exist, Rails turns it on. Previously this was done by effectively disabling errors on the Postgres connection, issuing a SET to turn the setting on, then re-enabling errors on the connection. However, if you're running pgbouncer in transaction-pooling mode, you can't guarantee that successive calls to `#execute` will be sent to the same pgbouncer-postgres connection, so you can end up disabling errors on a different postgres connection, and never re-enabling them. Future queries on that connection that result in errors (e.g. violating unique constraints) will leave the connection in a bad state where successive queries will fail. This commit sets standard_conforming_strings by issuing an UPDATE to pg_settings, which will update the setting if it exists, and do nothing if it doesn't (rather than erroring out like SET would), which means we can remove the error-disabling code. It's also worth noting that Postgres has allowed standard_conforming_strings to be updated since 8.2 (which is the oldest version Rails supports), so technically we probably don't even need to be defensive here.
* | Revert "Merge pull request #22026 from akihiro17/fix-preload-association"Sean Griffin2015-10-293-28/+0
| | | | | | | | | | | | | | This reverts commit 6dc6a0b17cfaf7cb6aa2b1c163b6ca141b538a8e, reversing changes made to ec94f00ba3cf250eb54fc5b7a5e3ed4b90164f34. This pull request broke the build.
* | Merge pull request #22118 from cllns/fix-spacing-in-layout-templateRafael França2015-10-291-16/+17
|\ \ | | | | | | Properly indent '<head>' and '<body>' within '<html>'
| * | Properly indent '<head>' and '<body>' within '<html>'Sean Collins2015-10-291-16/+17
| | |
* | | Deprecate `HWIDA.new_from_hash_copying_default`Sean Griffin2015-10-292-1/+6
|/ / | | | | | | This method was already niche, and is now redundant with `.new`
* | Merge pull request #16357 from gchan/hwia-respects-to-hash-defaultSean Griffin2015-10-294-8/+32
|\ \ | | | | | | | | | | | | `HashWithIndifferentAccess.new` respects the default value or proc on objects that respond to `#to_hash`
| * | `HashWithIndifferentAccess.new` respects the default value or proc on ↵Gordon Chan2014-07-314-8/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | objects that respond to `#to_hash`. Builds on the work of #12550 where `.new` will convert the object (that respond to `#to_hash`) to a hash and add that hash's keys and values to itself. This change will also make `.new` respect the default value or proc of objects that respond to `#to_hash`. In other words, this `.new` behaves exactly like `.new_from_hash_copying_default`. `.new_from_hash_copying_default` now simply invokes `.new` and any references to `.new_from_hash_copying_default` are replaced with `.new`. Added tests confirm behavior.
* | | Merge pull request #19501 from ccutrer/dry_sti_subclass_finding2Sean Griffin2015-10-296-23/+30
|\ \ \ | | | | | | | | | | | | DRY up STI subclass logic
| * | | Fix a stylistic nitpick in #19501Sean Griffin2015-10-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to use `String#+` or create all the intermediate strings to break a string into multiple lines. We can just write a c-style multiline string literal. This is by no means a hotpath, but this is clearer to me anyway.
| * | | Fix test failures caused by #19501Sean Griffin2015-10-293-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first one is quite straightforward. We want to give the proper error message in the case where a top level constant exists, but we're looking for a nested one. We just need to port over the change to use `subclass.name` into these changes. The second set of failures, which are only present in the mysql adapter tests, are stranger to me. The failure occurs because we were previously comparing `subclass.name == self.name` instead of `subclass == self`. However, I don't think that we need to support creating anonymous classes which share a table with a class that uses STI, overrides `name` to return the same name as athe class that we have no other relationship with, when not assigned to a constant so it could never be used anyway... The commits around why that exist give no context, and I think they're just poorly written tests (WTF does `test_schema` mean anyway, and why does calling `.first` on some anonymous class test it?). We'll just disable STI on that class.
| * | | Fix merge conflicts from #19501Sean Griffin2015-10-294-23/+28
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm making this commit separately because this has failing tests and style nitpicks that I'd like to make as individual commits, to make the changes I'm making explicit. We still want a single merge commit at the end, however.
| | * | | DRY up STI subclass logicCody Cutrer2015-03-244-22/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the newer method used for discriminating new records did not use the older and more robust method used for instantiating existing records, but did have a better post-check to ensure the sublass was in the hierarchy. so move the descendants check to find_sti_class, and then simply call find_sti_class from subclass_from_attributes now with fixed specs
* | | | | Merge pull request #22026 from akihiro17/fix-preload-associationYves Senn2015-10-293-0/+28
|\ \ \ \ \ | | | | | | | | | | | | Set `scope.reordering_value` to `true` if :reordering values aren't nil
| * | | | | Set `scope.reordering_value` to `true` if :reordering values are specifiedakihiro172015-10-303-0/+28
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | We should call `scope.order!` and set `scope.reordering_value` to `true` if :reordering values are specified Fixes #21886
* | | | | Merge pull request #22116 from gsamokovarov/fix-form-for-block-testYves Senn2015-10-291-2/+3
|\ \ \ \ \ | |/ / / / |/| | | | Fix a faulty form_for test
| * | | | Fix a faulty form_for testGenadi Samokovarov2015-10-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stumbled upon this one while trying to deprecate the String/Symbol passing to `form_for`. This test passed on an accident, because the signature of `form_for` currently accepts 2 positional arguments and a block. Calling it with the wrong number of arguments caused: ```ruby (byebug) form_for(:post, @post, html: { id: 'create-post' }) *** ArgumentError Exception: wrong number of arguments (3 for 1..2) ``` This made the test pass, because it was still an `ArgumentError`. :-)
* | | | | tests, no every adapter supports "connection.version"Yves Senn2015-10-292-22/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This solves the following issue: ``` $ bin/test Using sqlite3 /Users/senny/Projects/rails/activerecord/test/cases/adapters/mysql2/sp_test.rb:16:in `<class:Mysql2StoredProcedureTest>': undefined method `version' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x007f8bab4b5b70> (NoMethodError) from /Users/senny/Projects/rails/activerecord/test/cases/adapters/mysql2/sp_test.rb:5:in `<top (required)>' from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `require' from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `block in require' from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:268:in `load_dependency' from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `require' from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:11:in `block in require_files' from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:10:in `each' from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:10:in `require_files' from /Users/senny/Projects/rails/railties/lib/rails/test_unit/minitest_plugin.rb:69:in `plugin_rails_init' from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:73:in `block in init_plugins' from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:71:in `each' from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:71:in `init_plugins' from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:122:in `run' from bin/test:19:in `<main>' ```
* | | | | Merge pull request #22114 from oesgalha/docs_use_distinctZachary Scott2015-10-292-5/+5
|\ \ \ \ \ | | | | | | | | | | | | Use #distinct instead of #uniq in the guides
| * | | | | Use #distinct instead of #uniq in the guides [ci skip]oesgalha2015-10-292-5/+5
|/ / / / / | | | | | | | | | | | | | | | | | | | | * #uniq is an alias of #distinct * #uniq will be deprecated, see: rails/rails@adfab2dcf4003ca564d78d4425566dd2d9cd8b4f
* | | | | Ignore scope in missing translation input.Kasper Timm Hansen2015-10-282-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's already represented in the key name. Demonstrate with a test. Also test that the default isn't output.
* | | | | Merge pull request #21998 from kddeisz/rake_task_statisticsArthur Nogueira Neves2015-10-285-1/+23
|\ \ \ \ \ | | | | | | | | | | | | Allow rake:stats to account for rake tasks
| * | | | | Allow rake:stats to account for rake tasksKevin Deisz2015-10-195-1/+23
| | | | | |
* | | | | | Merge pull request #18548 from ↵Sean Griffin2015-10-287-0/+116
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sebjacobs/support-bidirectional-destroy-dependencies Add support for bidirectional destroy dependencies
| * | | | | | Add support for bidirectional destroy dependenciesSeb Jacobs2015-01-167-1/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this commit if you defined a bidirectional relationship between two models with destroy dependencies on both sides, a call to `destroy` would result in an infinite callback loop. Take the following relationship. class Content < ActiveRecord::Base has_one :content_position, dependent: :destroy end class ContentPosition < ActiveRecord::Base belongs_to :content, dependent: :destroy end Calling `Content#destroy` or `ContentPosition#destroy` would result in an infinite callback loop. This commit changes the behaviour of `ActiveRecord::Callbacks#destroy` so that it guards against subsequent callbacks. Thanks to @zetter for demonstrating the issue with failing tests[1]. [1] rails#13609
* | | | | | | Merge pull request #22073 from arunagw/remove-require-sdoc-rakefileArthur Nogueira Neves2015-10-281-1/+0
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Remove required `sdoc` from Rakefile
| * | | | | | | Remove required `sdoc` from RakefileArun Agrawal2015-10-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is required inside `api/task`
* | | | | | | | Merge pull request #22099 from yui-knk/doc_as_instrumentationArthur Nogueira Neves2015-10-281-0/+1
|\ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ |/| | | | | | | [ci skip] Add `:binds` to a list of paramaters of `sql.active_record`
| * | | | | | | [ci skip] Add `:binds` to a list of paramaters of `sql.active_record`yui-knk2015-10-281-0/+1
| | | | | | | |
* | | | | | | | Merge pull request #22096 from Gaurav2728/change_deprecated_msgRichard Schneeman2015-10-282-6/+6
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | specify deprecated waring, follow the standard conventions
| * | | | | | | specify deprecated waring, follow the standard conventionsGaurav Sharma2015-10-282-6/+6
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | `skip_filter`, `skip_action_callback` may both are deprecated in Rails 5.1 so waring msg should be specific.
* | | | | | | Write the cookie jar it was not committed in TestCaseRafael Mendonça França2015-10-282-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ActionController::Base we write the cookies in a middleware if it was not yet committed no matter if the response was committed or not. [1] For ActionController::Live we write the cookies before the response is committed. [2] We already mimic ActionController::Live in ActionController::TestCase but we don't mimic the ActionController::Base behavior because we were checking if the response was committed before writing the cookies. Now we are matching the behavior of the middleware and writing the cookies if it was not written before. [1]: https://github.com/rails/rails/blob/80c6b901d4d87cee610ab0a438ff6e3c6bf118d1/actionpack/lib/action_dispatch/middleware/cookies.rb#L599-L604 [2]: https://github.com/rails/rails/blob/80c6b901d4d87cee610ab0a438ff6e3c6bf118d1/actionpack/lib/action_controller/metal/live.rb#L218-L223
* | | | | | | Remove dead codeRafael Mendonça França2015-10-281-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is leftover from when `render nothing: true` rendered blank string.
* | | | | | | Merge pull request #22095 from ↵Rafael França2015-10-271-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ajmyers01/fix_typo_in_eager_load_polymorphic_error Fix Typo in EagerLoadPolymorphicError [ci skip]
| * | | | | | | Fix Typo in EagerLoadPolymorphicError [ci skip]Alex Myers2015-10-271-1/+1
|/ / / / / / /
* | | | | | | Merge pull request #18383 from ↵Rafael Mendonça França2015-10-273-1/+40
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scambra/habtm-with-where-includes-16032-for-master Includes HABTM returns correct size now
| * | | | | | | Includes HABTM returns correct size now. It's caused by the join dependencySergio Cambra2015-01-073-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | only instantiates one HABTM object because the join table hasn't a primary key. Updated commit from @bigxiang commit dbaa837 Fixes #16032. Examples: before: Project.first.salaried_developers.size # => 3 Project.includes(:salaried_developers).first.salaried_developers.size # => 1 after: Project.first.salaried_developers.size # => 3 Project.includes(:salaried_developers).first.salaried_developers.size # => 3
* | | | | | | | Merge pull request #22093 from y-yagi/fix_typo_in_db_purgeRafael França2015-10-271-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | fix typo in `db:purge` description [ci skip]
| * | | | | | | | fix typo in `db:purge` description [ci skip]yuuji.yaginuma2015-10-281-1/+1
|/ / / / / / / /
* | | | | | | | Merge pull request #22087 from yui-knk/fix_ar_changelogKasper Timm Hansen2015-10-271-17/+14
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | [ci skip] Aline code examples in AR changelog
| * | | | | | | | [ci skip] Aline code examples in AR changelogyui-knk2015-10-271-17/+14
| | | | | | | | |
* | | | | | | | | Merge pull request #22078 from arunagw/secret-key-as-an-integerSantiago Pastorino2015-10-272-0/+16
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | raise `ArgumentError` when `SECRET_KEY_BASE` is an integer
| * | | | | | | | raise `ArgumentError` when `SECRET_KEY_BASE` is an integerArun Agrawal2015-10-272-0/+16
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If `SECRET_KEY_BASE` or other `secret` gets passed as other then string we need to raise `ArgumentError` to know that it's a wrong argument. Closes #22072
* | | | | | | | Remove skipped JRuby tests that are passing on 9.0.3.0.Guo Xiang Tan2015-10-273-6/+0
| | | | | | | |
* | | | | | | | Revert "Merge pull request #21994 from mtodd/inherit-scopes"Rafael Mendonça França2015-10-272-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 60c9701269f5b412849f1a507df61ba4735914d7, reversing changes made to 6a25202d9ea3b4a7c9f2d6154b97cf8ba58403db. Reason: Broken build
* | | | | | | | Merge pull request #21994 from mtodd/inherit-scopesArthur Neves2015-10-262-3/+3
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix InheritanceTest#test_scope_inherited_properly implementation bugs