Allow ConnectionPool's #table_exists? method to give the connection's #table_exists? method a chance. #1635

wants to merge 204 commits into

The use case for the default abstract adapter's #table_exists? method is to give adapters a chance to return true in special cases where the core #tables does not include a name. Common use cases are for views and tables in other schemas. The connection pool should give a connection to respond true to with this matching name. If this was not done, I get errors in the SQL Server Adapter where column objects are not cached and respond properly for either the entire table or specific attribute of columns for said table, like @primary. This fixes that.

I did not include a test because this looked to be too low level white-box testing and I could not see any parallel in the connection_pool_test.rb file All tests for MySQL, PostgreSQL, and SQLite3 still pass with this change.

josevalim and others added some commits May 23, 2011
@josevalim josevalim Use Rack 1.3.0. 7236861
@josevalim josevalim Move content length to the server, this brings the same behavior as i…
…n rack 1.2.
@joshk joshk deprecate AS core_ext/kernel/requires in 3.1 d79e284
@josevalim josevalim Merge pull request #1235 from joshk/deprecate_kernel_requires
Deprecate kernel requires
@jonleighton jonleighton Replace references to ActiveSupport::SecureRandom with just SecureRan…
…dom, and require 'securerandom' from the stdlib when active support is required.
@jonleighton jonleighton Deprecate ActiveSupport::SecureRandom. Just use SecureRandom which is…
… provided by the standard library.
@jonleighton jonleighton Fix problem with loading polymorphic associations which have been def…
…ined in an abstract superclass. Fixes #552.
@dhh dhh The asset pipeline is always on for new apps, dont need the legacy js…
… ext stuff
@dhh dhh Remove asserts for js ext stuff thats not used any more c77bdc0
@JoeyButler JoeyButler Add failing test case for issue 796 177666e
@tenderlove tenderlove do not bother with assert_nothing_raised, the test will fail and we g…
…et a better trace without it
@tenderlove tenderlove adding a test for create! with invalid associations b102e60
@tenderlove tenderlove add tests surrounding behavior of save and save! for associations tha…
…t have validation errors
@tenderlove tenderlove rescue record invalid exceptions and return false from the save metho…
…d. fixes #796
tomhuda Change compressor API so that plugins can register default compressor…
…s for their stylesheet or JS engines and still allow the user to turn off compression
tomhuda Move SCSS generators and default templates from Rails to the Sass Rai…
…ltie (d435726312601edb3ba6f97b34f562221f72c1f8).

* Sass gem registers a compressor
* Sass gem registers generators for assets and scaffold
* Create a default stylesheet_engine ("css") for apps that remove the Sass gem
@wycats wycats Update generator config to support hiding namespaces and pass the app…
… into generator blocks
@wycats wycats Hide css:* and the default stylesheet from rails g 23820a2
@wycats wycats Update default Gemfile to point to sass-rails, not sass c08f845
@pixeltrix pixeltrix Failing tests for #1233. 0daf574
@jonleighton jonleighton Ensure that the surrounding code in Relation#to_a respects the defaul…
…t_scope (as well as having Relation#arel respect the default scope). Fixes #1233.
@pixeltrix pixeltrix Ignore :includes on through associations 8a4263c
@jonleighton jonleighton Fix infinite recursion where a lazy default scope references a scope.…
… Fixes #1264.
@josevalim josevalim Everyone receives app as argument for consistency.

@wycats wycats Renaming helper in the Rake task, but why is this needed in the first…
… place? (paging JP)

@wycats, Where is this defined? I get uninitialized constant Sprockets::Helpers when trying to run the rake task...

PS not sure why this line is needed. Commenting it out does what is expected...

Update: Nope, it is needed. Without it you do not get hashed asset paths in the css img tags.

joshk and others added some commits May 25, 2011
@joshk joshk correction to the AR::Base#attributes= guard_protected_attributes dep…
…recation message
@josevalim josevalim Merge pull request #1313 from joshk/deprecation_message_correction
Deprecation message correction
@dmathieu dmathieu don't raise an exception if the format isn't recognized
Fixed while traveling to heuruko
@tenderlove tenderlove adding a test for #1322 37b2104
@tenderlove tenderlove fixing test for mysql2 c0c9a33
@tenderlove tenderlove work around bug in the sqlite3 bindings. fixes #1289 18a2dfb
@jacott jacott fixed asset_paths when called from sprockets for relative_url_root db05478
@amatsuda amatsuda Disable IdentityMap by default for ActiveRecord testing
because enabling IM by default will possibly hide some bugs on 3.1 default behavior
@tenderlove tenderlove Merge pull request #1375 from amatsuda/disable_im_by_default_on_test_31
Disable IdentityMap by default for ActiveRecord testing on 3-1-stable
@jonleighton jonleighton Implementing @dmathieu's cleaner fix from #1425. Unfortunately he del…
…eted the branch so I cannot just merge it.
@farleyknight farleyknight Tests for issue #1360 842043e
@jonleighton jonleighton Only save the record once when calling create! on a collection associ…
…ation. Fixes #1360.
@Fonsan Fonsan Failing test for aggregating on default_scope with select c22364b
@jonleighton jonleighton Ensure that calculations properly override the select value even if i…
…t's set in the default scope. Fixes #1395.
@pixeltrix pixeltrix Make MemCacheStore work with Ruby 1.9 and -Ku de7fecb
@joshk joshk added an alias for new to build to the AR collection proxy, this corr…
…ects an issue where the collection proxies were not consistent
@jonleighton jonleighton Merge pull request #1437 from joshk/ar_collection_new_alias
Ar collection new alias
@jonleighton jonleighton Merge pull request #1437 from joshk/ar_collection_new_alias
Ar collection new alias
@jonleighton jonleighton Merge pull request #1437 from joshk/ar_collection_new_alias
Ar collection new alias
@pixeltrix pixeltrix Raise NameError instead of ArgumentError in ActiveSupport::Dependencies
ActiveSupport::Dependencies now raises NameError if it finds an existing
constant in load_missing_constant. This better reflects the nature of
the error which is usually caused by calling constantize on a nested constant.

Closes #1423
@winterchord winterchord Fix issue #1272
Set reverse_order_value when asked to reverse_order().
Do the actual reversal in build_arel.
@vatrai vatrai AttributeMethodTest test fix #jruby 26d0f42
@arunagw arunagw Adding comment 7f34d5b
@arunagw arunagw Loading files if PLATFORM available. 98cd7ca
@arunagw arunagw Using java_import instead of import. Need with rake 0.9.0 60c9b7b
@arunagw arunagw Fixing XMLMini_JDOM 88813e1
@arunagw arunagw Fixed tests for JDOM. File From Xml is working now 425c892
@arunagw arunagw Indented as required. 68fc6ba
@jonleighton jonleighton Merge pull request #1444 from arunagw/3-1-stable
Jruby fixes for 3 1 stable
@arunagw arunagw Import => java_import performance test #jruby 42b8fb1
@jonleighton jonleighton Merge pull request #1451 from arunagw/3-1-stable
3-1-stable import to java_import
@jonleighton jonleighton Fix broken test. You know, the merge button will be the end of us... 03d087d
@dhh dhh Revert "Renaming helper in the Rake task, but why is this needed in t…
…he first place? (paging JP)" -- Waiting on YK to fix.

This reverts commit e144b3e3cf9b4d3e4d4669fce5a13b8a19811bc8.
@wycats wycats Start moving some logic from being embedded in AV into the Rails Spro…
…ckets extensions
@wycats wycats Move javascript/css helpers into the Sprockets helper and just have t…
…hem override the old behavior
@wycats wycats Move the last pockets of Sprockets stuff into the Sprockets directory ee018be
@wycats wycats Make sure that Sprockets::Helpers::RailsHelper can be found 7a8d3d7
@wycats wycats Update generator config to support hiding namespaces and pass the app…
… into generator blocks
@wycats wycats Renaming helper in the Rake task, but why is this needed in the first…
… place? (paging JP)
@wycats wycats Pull back in asset_path 5b300a9
@wycats wycats Remove explicit sprockets usage. This should have come over in the me…
…rge, but for some reason it didn't.

undefined method `sprockets_javascript_include_tag' for #<#Class:0x00000104902360:0x000001048ddbf0>

whenever I use a simple

javascript_include_tag 'application'

I forgive you :)

@wycats, one more: #1473

Yes, I'm getting ActionController::RoutingError (No route matches [GET] "/javascripts/application.js") and stuff :o)

wycats and others added some commits May 23, 2011
@wycats wycats Restructure TemplateAssertions-related code to eliminate circular req…

Also, no need to include dependencies in AS::Concerns inside included blocks.
@vijaydev vijaydev fixes Rake::GemPackageTask deprecation warnings from rake 0.9.0 a81c2ec
@vijaydev vijaydev fixes Rake::RDocTask deprecation warnings from rake 0.9.0 b6040f4
@fxn fxn specify image dimensions for pictures in the guides credits page aedc627
@fxn fxn adds Ryan Bigg to the credits page of the guides, he is the author of…
… the new configuring guide
@fxn fxn move Ryan up, since the list is ordered by surname 63eab0b
@fxn fxn adds Vijay Dev to the new Rails Guides Reviewers team 3939fbd
@jonleighton jonleighton Force RAILS_ENV=development in rackup_test.rb. This fixes a problem o…
…n the CI server. For some reason the RAILS_ENV on the CI server is production, which means that the ActionDispatch::Static middleware is not used, and so the request in ' can be racked up' returns a 404 rather than a 200.
@jonleighton jonleighton Refactor Active Record test connection setup. Please see the RUNNING_…
…UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
@jonleighton jonleighton Bring back oracle specific crap 550064c
@jonleighton jonleighton Fix typo 6925423
@jonleighton jonleighton Fix adapter_test.rb to make no assumptions about the database name 04d238b
@arunagw arunagw Loading multi_json instead of i18n gem.
Don't know why it's giving error with i18n gem. 
Changing this as it dosn't matter with specific gem.
@josevalim josevalim Merge pull request #1495 from arunagw/fixed_failing_isolated_test
Fixed failing isolated test
@jonleighton jonleighton load_path_test.rb is also dependent on RAILS_ENV=development 3ac805b
Ruby on Rails member

Green 3-1-stable branch :-)

r00k and others added some commits May 27, 2011
@r00k r00k Improve 'Joining Tables' section with additional examples and explana…
@r00k r00k Copy edits 64148ab96b47a9904fdd839bc69971b4e156bb04 (previous commit)…
…. Please squash at will.
@r00k r00k Fix incorrect description of the returned results. 8b72166
@vijaydev vijaydev document aliases for commands and update rails versions 1d654cc
@vijaydev vijaydev fix typo 39e5cbc
@vijaydev vijaydev removed references to old remote_* helpers; add info about 3.1 adding…
… multipart option to a form with file_field automatically
@evanfarrar evanfarrar Typo and sentence restructuring 3a22027
@htanata htanata Update Rails coding conventions link. 2e7a039
@htanata htanata Fix punctuation. 7ff491c
@mjroghelia mjroghelia The example in the API docs incorrectly indicated that form_for would…
… use the same default route for both new and previously persisted records. The default path given in the example would have generated a routing error for new records. form_for actually uses polymorphic_path to determine which route to use based on the state of the record. The example has been updated to reflect the method's actual behavior.
@guilleiguaran guilleiguaran Removing trailing white-spaces 48b9096
@amatsuda amatsuda s/an/a/ 4c716e6
@amatsuda amatsuda s/a/an/ 6f3d997
@dafaqisdat dafaqisdat The URL is no …
…longer available
@dafaqisdat dafaqisdat Edited activerecord/lib/active_record/transactions.rb via GitHub 6ad8f6e
@vijaydev vijaydev add alias info for runner command f51cea6
@r00k r00k Change hashrocket spacing to match conventions. f4a4d5f
@brianp brianp Fixed sections regarding validations and callbacks to mention the tou…
…ch method does not fire either validations or callbacks as stated in the docs.
@vijaydev vijaydev fix indentation, fixed-width for nils 40e7682
@vijaydev vijaydev remove stray ( 69b3c9c
@linuxonrails linuxonrails FIXED: error with url_for & link_to when we have nested resources. f7ac354
ganesh updated Changelog 5e44184
@sikachu sikachu Revise documentation indentation from [79990505e5080804b53d81fec05913…
@waynn waynn add a missing "the" and normalize the use of periods. d57cfc1
@vijaydev vijaydev use clearer variable name in examples 424d725
@rohit rohit Upcoming version of Rails is upon us so no need to refer to it. [API …
Alberto Perdomo Fixed order of parameters in assert_equal call examples, first expect…
…ed, then actual object.
@vijaydev vijaydev fix incorrect output 0e8857b
@vijaydev vijaydev some grammatical corrections dff7c62
@vijaydev vijaydev fix incorrect module name for wrap parameters 2974869
@vijaydev vijaydev minor corrections in generators guide b1919b1
@vijaydev vijaydev s/ActiveRecord/Active Record according to api guidelines 3432775
@vijaydev vijaydev correct code indendation in the initialization guide 670ae12
@guilleiguaran guilleiguaran Remove trailing white-spaces 527499c
@vijaydev vijaydev annotate class_eval method for active resource schema attributes 47670a5
@vijaydev vijaydev minor edits in migrations guide 5d4b73a
@guilleiguaran guilleiguaran Change to c1ce168
@Arsen7 Arsen7 Validations guide: order of :after_save callback was incorrect.
The guide was contracting itself. First it stated that 'there is a list
of callbacks in order of execution', on the list 'after_save' was placed
before 'after_create', and then there was a warning that 'after_save'
runs after them. I am not sure about 'around_' callbacks, but let's
leave that for another patch.
@vijaydev vijaydev document assets related rake tasks 3962d94
@vijaydev vijaydev rearrange sections of the commandline guide giving more importance to…
… rake tasks
@vijaydev vijaydev up and down are no longer class methods in a migration 59016b9
@vijaydev vijaydev comment the recorder methods fa1aad7
@vijaydev vijaydev add info about docrails policy on changelogs 95f3046
@tenderlove tenderlove please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT e504101
@tenderlove tenderlove add test to the include path b8714ed
@tenderlove tenderlove updating configs for oracle 10eb479
@tenderlove tenderlove do not muck with the load path, that is the test task responsibility 50d331d
@tenderlove tenderlove more oracle fixes 606108a
@tenderlove tenderlove set the environment variable from the rake file 945b131
@tenderlove tenderlove oops! add parens so the block is properly bound 75fb26a
@tenderlove tenderlove make sure AR isolated tests set the environment variable 377b15a
@fxn fxn adds missing require 645f138
@guilleiguaran guilleiguaran Fixing Rails::Server#app under Rack::URLMap 8d758d8
@josevalim josevalim Merge pull request #1527 from guilleiguaran/3-1-stable
Rails::Server#app should be nice with Rack::URLMap (3.1 stable)
@chriseppstein chriseppstein Use the sass-rails release candidate until full release. 654514a
@tenderlove tenderlove Merge pull request #1528 from chriseppstein/3-1-stable
Update project Gemfile to use the sass-rails rc
@dmitriy-kiriyenko dmitriy-kiriyenko Do not use default_scope in ActiveRecord::Persistence#touch. 54f5fb5
@dmitriy-kiriyenko dmitriy-kiriyenko This way asserting that updated_at was changed in touch look more obv…
@fxn fxn sprockets gzips assets now

@fxn fxn mention assets:clean in railties CHANGELOG 296ca01
@vijaydev vijaydev fix indents and a code error in caching guide da5122e
@vijaydev vijaydev proof reading and fixes in configuring guide 2cbd024
@vijaydev vijaydev add missing generator configs f8f00cc
@vijaydev vijaydev fix spacing

@jonleighton jonleighton When you add a record to a polymorphic has_one, you should be able to…
… access the owner from the associated record
@jonleighton jonleighton Allow polymorphic has_one to work when the association is set before …
…the owner has been saved. Fixes #1524.
@tenderlove tenderlove bumping to rails 3.1.0.rc2 2664897
@NZKoz NZKoz Ensure that the strings returned by SafeBuffer#gsub and friends aren'…
…t considered html_safe?

Also make sure that the versions of those methods which modify a string in place such as gsub! can't be called on safe buffers at all.


@cmeiklejohn cmeiklejohn Fragment caching needs to operate on the pure output, not the
@sikachu sikachu Fix `simple_format` helper to work correctly with the new SafeBuffer …

This has been ported from `3-0-stable` [ed3796434af6069ced6a641293cf88eef3b284da]
@sikachu sikachu Adapt [823aa223efbac6ad4d31ea33402892267bb77cb4] to make sure we perf…
…orm cloning before manipulation only on `OutputBuffer`.

After the fragment rendering, `Builder` returns the `String` object instead of `ActionView::OutputBuffer`. Somehow the same procedure which was in [823aa223efbac6ad4d31ea33402892267bb77cb4] does not play nice with the String, and result in the fragment got lost.
@sikachu sikachu Add proper fix to `mail_to` helper.
* Fix the problem on manipulating on the `ActiveSupport::SafeBuffer`
* Make sure that we run `escape_javascript` on the `String`, to avoid unexpected behavior.
@josevalim josevalim Merge pull request #1546 from sikachu/31safebuffer
Fix failing ActionPack tests on 3-1-stable
@rsim rsim Do not hardcode :id as it was ignored by mass assignment filter
As a result test was failing on Oracle where ids are assigned by default from 1000
@guilleiguaran guilleiguaran Allow multiple sources in Sprockets helpers 6e9714c
@josevalim josevalim Merge pull request #1557 from guilleiguaran/multiple-sources-sprocket…

Multiple sources in sprockets helpers (backported from master)
@tardate tardate Make escape_javascript happy to handle SafeBuffers
* see GH#1553
* allow for the fact that gsub on SafeBuffer does not pass match variables $1, $2 etc to a block
@josevalim josevalim Merge pull request #1561 from sikachu/3-1-escapejs
Make escape_javascript happy to handle SafeBuffers
@thoefer2 thoefer2 Brought back alternative convention for namespaced models in i18n. 3451bcb
@josevalim josevalim Merge pull request #1562 from sikachu/3-1-i18n-convention
Brought back alternative convention for namespaced models in i18n.
@sikachu sikachu Update CHANGELOG to mention the new SafeBuffer change d2b0605
@bhavinkamani bhavinkamani fix connection not established error while running rake task
(cherry picked from commit e9a2ff8bb7fbc81c35bc6c725d7cf6cb52c53f5a)
@tenderlove tenderlove Merge pull request #1566 from sikachu/3-1-stable-changelog
Update CHANGELOG to mention the new SafeBuffer change

I think it was correct before this change.

You're right: this change was incorrect. I fixed it in a later commit.


Will it really raise an exception here without explicit Create! ?

Ruby on Rails member

It's testing that create doesn't raise with a validation error so we don't want it to raise - using create! will ensure that it does.

Ruby on Rails member

But this patch converts a potential failure into a potential error, doesn't it? If the test does not pass I want a F, not a E.

Ruby on Rails member

Yes, but that wasn't the question :-)

As for what @tenderlove has against assert_nothing_raised you'll have to ask him.

Ruby on Rails member

Oh yes, only the thread drove my attention to the patch. I know Se~nor Patterson doesn't like that helper, and he knows I think it makes sense, so these comments are a no-op effectively :).

Ruby on Rails member

If we're taking sides I also have passionate hatred for assert_nothing_raised ;)

Ruby on Rails member

Haha. For me it is OK for sure. Now that test is unconventional, what is testing is implicit, while the reader expects what is tested to be asserted. Before, the intention was clear and you got a F. Standard behavior. Now it says nothing and you get an E. Definitely -1 from me :).

Ruby on Rails member

Yes, I would personally rewrite the test completely along the lines of:

  1. Work out what you were actually trying to achieve when an exception was raised
  2. Write a test which tries to achieve that and asserts that it has been achieved
  3. See that an exception is raised. Fix it.
  4. Win.
Ruby on Rails member

But we're testing that create doesn't raise when it has validation errors - generally I'd agree, but I think this case is different.


Crap, this did not come out right. Let me close this and do another.

@metaskills metaskills closed this Jun 10, 2011

is there a reason to choose sass-rails over sass? Can you give any details about the specific differences?

Ruby on Rails member

For the convention sake :) So everything which is a "bridge" between two things will be appended by -rails

As you can see, jquery-rails, prototype-rails for example :)

Ruby on Rails member

It's not purely for convention's sake. It's in order to provide a place for code that only makes sense in the presence of BOTH Sass and Rails. The only alternative is to do an if defined?(Foo) check in one or the other, which is pretty brittle. In addition to it being a good idea architecturally, this makes it really easy to have a repo that all stakeholders have access to and can work on. Chris Eppstein has done most of the work on sass-rails since my initial commit, even though he isn't on Rails core.

@jake3030 jake3030 pushed a commit to jake3030/rails that referenced this pull request Jun 28, 2011
@yaroslav yaroslav Update i18n gem to version 0.1.1 (Rails' changes were backported) [#1635

Signed-off-by: David Heinemeier Hansson <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment