aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge pull request #18885 from ypxing/masterRafael Mendonça França2015-02-121-12/+7
|\ \ \ \ \ \ | | | | | | | | | | | | | | remove unnecessary assignment/parameter passing in AS::Callbacks...::Around (master branch)
| * | | | | | remove unnecessary assignment and parameter passing in ↵rxing2015-02-111-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveSupport::Callbacks::Filters::Around
* | | | | | | get rid of transaction warning when running PG tests.Yves Senn2015-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This finally removes the warning "WARNING: there is no transaction in progress" when running Active Record tests using PostgreSQL.
* | | | | | | pg tests, be clear about the missing type that causes a test skip.Yves Senn2015-02-122-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also removed some cruft in the `setup` and `teardown` methods.
* | | | | | | tests, remove unused requires.Yves Senn2015-02-122-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "active_support/testing/stream" is already required in `test_case.rb`. Furthermore the test "test/cases/migration_test.rb" could no longer be executed directly.
* | | | | | | Merge pull request #18911 from y-yagi/fix-typoKasper Timm Hansen2015-02-121-3/+3
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | fix typo in fresh_when example [ci skip]
| * | | | | | | fix typo in fresh_when example [ci skip]yuuji.yaginuma2015-02-121-3/+3
| | | | | | | |
* | | | | | | | Merge pull request #18907 from square/dont-load-app-on-structureYves Senn2015-02-121-1/+1
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | Schema creation doesn't load the app
| * | | | | | | Schema creation doesn't load the appTamir Duberstein2015-02-111-1/+1
| | |/ / / / / | |/| | | | |
* / | | | | | Properly dump primitive-like AS::SafeBuffer strings as YAMLGodfrey Chan2015-02-113-1/+29
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `coder.represent_scalar` means something along the lines of "Here is a quoted string, you can just add it to the output", which is not the case here. It only works for simple strings that can appear unquoted in YAML, but causes problems for e.g. primitive-like strings ("1", "true"). `coder.represent_object` on the other hand, means that "This is the Ruby-object representation for this thing suitable for use in YAML dumping", which is what we want here. Before: YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello" YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1 YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1 After: YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello" YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true" YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false" YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1" YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1" If we ever want Ruby to behave more like PHP or JavaScript though, this is an excellent trick to use ;)
* | | | | | Don't break enum on PGSean Griffin2015-02-111-1/+1
| | | | | |
* | | | | | Refactor enum to be defined in terms of the attributes APISean Griffin2015-02-113-44/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition to cleaning up the implementation, this allows type casting behavior to be applied consistently everywhere. (#where for example). A good example of this was the previous need for handling value to key conversion in the setter, because the number had to be passed to `where` directly. This is no longer required, since we can just pass the string along to where. (It's left around for backwards compat) Fixes #18387
* | | | | | `current_scope` shouldn't pollute sibling STI classesSean Griffin2015-02-114-6/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It looks like the only reason `current_scope` was thread local on `base_class` instead of `self` is to ensure that when we call a named scope created with a proc on the parent class, it correctly uses the default scope of the subclass. The reason this wasn't happening was because the proc captured `self` as the parent class, and we're not actually defining a real method. Using `instance_exec` fixes the problem. Fixes #18806
* | | | | | Merge pull request #18888 from kamipo/refactor_quote_default_expressionRafael Mendonça França2015-02-114-18/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | Refactor `quote_default_expression`
| * | | | | | Refactor `quote_default_expression`Ryuta Kamizono2015-02-114-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `quote_default_expression` and `quote_default_value` are almost the same handling for do not quote default function of `:uuid` columns. Rename `quote_default_value` to `quote_default_expression`, and remove duplicate code.
* | | | | | | Merge pull request #18906 from awd/fix-test-descriptionRafael Mendonça França2015-02-111-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fixes incorrect wording of test description
| * | | | | | | Fixes wording of test descriptionAdam Doeler2015-02-111-1/+1
| | | | | | | |
* | | | | | | | Merge pull request #18374 from claudiob/add-collection-to-fresh-whenRafael Mendonça França2015-02-113-11/+103
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Accept a collection in fresh_when and stale?
| * | | | | | | | Accept a collection in fresh_when and stale?claudiob2015-02-103-11/+103
| | |/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The methods `fresh_when` and `stale?` from ActionController::ConditionalGet accept a single record as a short form for a hash. For instance ```ruby def show @article = Article.find(params[:id]) fresh_when(@article) end ``` is just a short form for: ```ruby def show @article = Article.find(params[:id]) fresh_when(etag: @article, last_modified: @article.created_at) end ``` This commit extends `fresh_when` and `stale?` to also accept a collection of records, so that a short form similar to the one above can be used in an `index` action. After this commit, the following code: ```ruby def index @article = Article.all fresh_when(etag: @articles, last_modified: @articles.maximum(:created_at)) end ``` can be simply written as: ```ruby def index @article = Article.all fresh_when(@articles) end ```
* | | | | | | | Merge pull request #18845 from bogdan/remove-code-dups-in-action-viewRafael Mendonça França2015-02-112-33/+25
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Remove some code duplication in ActionView tags code
| * | | | | | | | Remove code duplication in ActionView::Helpers::Tags::BaseBogdan Gusiev2015-02-112-33/+25
| | | | | | | | |
* | | | | | | | | Revert 88d08f2ec9f89ba431cba8d0c06ac9ebc204bbbbRafael Mendonça França2015-02-112-13/+25
| |_|/ / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This caused a performance regression since we were decided to do the nil check in run time not in the load time. See https://github.com/rails/rails/pull/15187#issuecomment-71760058
* | | | | | | | Remove the SQLite3 Binary subclassSean Griffin2015-02-112-28/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As far as I can tell, the original reason that this behavior was added has been sufficiently resolved elsewhere, as we no longer remove the encoding of strings coming out of the database.
* | | | | | | | Reduce object allocations in ActiveSupport::Subscribereileencodes2015-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Freezing the string literal reduces the number of objects allocated during integration test runs. AllocationTracer before: ``` [["/rack/lib/rack/utils.rb", 499, :T_STRING], [50939, 2737, 78553, 0, 13, 1783920]] [["/rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [44959, 0, 42633, 0, 2, 1670800]] [["/rack/lib/rack/utils.rb", 662, :T_STRING], [32979, 0, 31263, 0, 1, 1226009]] [["/rack/lib/rack/body_proxy.rb", 34, :T_ARRAY], [29988, 0, 28438, 0, 1, 1114320]] [["/rails/activesupport/lib/active_support/callbacks.rb", 165, :T_DATA], [29968, 0, 28422, 0, 2, 3675936]] ``` AllocationTracer after: ``` [["/rack/lib/rack/utils.rb", 499, :T_STRING], [50983, 4080, 67269, 0, 12, 1815600]] [["/rack/lib/rack/utils.rb", 662, :T_STRING], [33001, 0, 28420, 0, 2, 1230809]] [["/rack/lib/rack/body_proxy.rb", 34, :T_ARRAY], [29990, 0, 25812, 0, 1, 1118000]] [["/rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [29986, 0, 25803, 0, 1, 1117840]] [["/rails/activesupport/lib/active_support/notifications/instrumenter.rb", 52, :T_HASH], [29984, 28, 26133, 0, 11, 4953280]]
* | | | | | | | Remove an unused option that I didn't mean to commit [ci skip]Sean Griffin2015-02-111-2/+1
| | | | | | | |
* | | | | | | | Remove most PG specific type subclassesSean Griffin2015-02-1114-91/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The latest version of the PG gem can actually convert the primitives for us in C code, which gives a pretty substantial speed up. A few cases were only there to add the `infinity` method, which I just put on the range type (which is the only place it was used). Floats also needed to parse `Infinity` and `NaN`, but it felt reasonable enough to put that on the generic form.
* | | | | | | | Merge pull request #18883 from ↵Sean Griffin2015-02-113-23/+46
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/fix_datetime_precision_dumping_zero_for_postgresql The datetime precision with zero should be dumped
| * | | | | | | | The datetime precision with zero should be dumpedRyuta Kamizono2015-02-113-23/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `precision: 0` was not dumped by f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7. However, `precision: 0` is valid value for PostgreSQL timestamps.
* | | | | | | | | prefer `drop_table :table, if_exists: true` over explicit checks.Yves Senn2015-02-111-2/+2
| | | | | | | | |
* | | | | | | | | add test to ensure `remove_reference` with index and fk is invertable.Yves Senn2015-02-111-0/+5
| | | | | | | | |
* | | | | | | | | fix `remove_reference` with `foreign_key: true` on MySQL. #18664.Yves Senn2015-02-113-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MySQL rejects to remove an index which is used in a foreign key constraint: ``` ActiveRecord::StatementInvalid: Mysql2::Error: Cannot drop index 'index_copies_on_title_id': needed in a foreign key constraint: ALTER TABLE `copies` DROP `title_id` ``` Removing the constraint before removing the column (and the index) solves this problem.
* | | | | | | | | Merge pull request #18890 from kamipo/remove_cast_typeYves Senn2015-02-111-1/+1
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Remove `cast_type` in `ColumnDefinition`
| * | | | | | | | | Remove `cast_type` in `ColumnDefinition`Ryuta Kamizono2015-02-111-1/+1
| | |_|/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | This is no longer needed.
* | | | | | | | | guides, various testing guide changes. [ci skip]Yves Senn2015-02-111-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /cc @zzak
* | | | | | | | | Merge pull request #18363 from ↵Yves Senn2015-02-111-0/+16
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | andreynering/add-foreign-key-subsection-in-upgrading-guide Adding subsection on 'Upgrading' guide about foreign key support [ci skip]
| * | | | | | | | | Adding subsection on 'upgrading' guide about 4.2 foreign key support [ci skip]Andrey Nering2015-02-101-0/+14
| | | | | | | | | |
* | | | | | | | | | Merge pull request #18892 from robertzk/typo_in_rails_engine_rbZachary Scott2015-02-101-4/+4
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Fix some typos in railties/lib/rails/engine.rb [ci-skip]
| * | | | | | | | | | Fix some typos in railties/lib/rails/engine.rb [ci-skip]RobertZK2015-02-101-4/+4
|/ / / / / / / / / /
* | | | | | | | | | Merge pull request #18891 from robertzk/typo_in_rails_application_rbArthur Nogueira Neves2015-02-101-2/+2
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Fix typo in Rails::Application#migration_railties documentation [ci-skip]
| * | | | | | | | | | Fix typo in Rails::Application#migration_railtiesRobertZK2015-02-101-2/+2
|/ / / / / / / / / /
* | | | | | | | | | Merge pull request #18889 from kamipo/use_kwargs_in_transactionRafael Mendonça França2015-02-111-6/+4
|\ \ \ \ \ \ \ \ \ \ | |_|/ / / / / / / / |/| | | | | | | | | Use keyword argument in `transaction`
| * | | | | | | | | Use keyword argument in `transaction`Ryuta Kamizono2015-02-111-6/+4
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The keys are already validated, so it is better to use the built-in feature to do this.
* | | | | | | | | Merge pull request #18884 from rails/fix-kwarg-on-staleRafael Mendonça França2015-02-102-1/+2
|\ \ \ \ \ \ \ \ \ | |_|/ / / / / / / |/| | | | | | | | Fix wrong kwarg "record" from #18872
| * | | | | | | | Fix wrong kwarg "record" from #18872claudiob2015-02-102-1/+2
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR #18772 changed the parameters of `stale?` to use `kwargs`. [As for this comment](https://github.com/rails/rails/pull/18872/files#r24456288) the default value for the `etag` parameter should be `record`, not `nil`. This commit fixes the code and introduces a test that: - passed before #18872 - fails on the current master (after #18772) - passes again after setting the default value of `etag` to `record`.
* | | | | | | | Merge pull request #18872 from kaspth/kw-fresh_when-staleArthur Nogueira Neves2015-02-101-12/+10
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | Convert stale? and fresh_when to use keyword arguments.
| * | | | | | | Convert stale? and fresh_when to use keyword arguments.Kasper Timm Hansen2015-02-101-12/+10
| | | | | | | |
* | | | | | | | Dont check bundler output on plugin generator testArthur Neves2015-02-101-4/+2
| | | | | | | |
* | | | | | | | Actually fix the buildSean Griffin2015-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Like for real this time. I checked.
* | | | | | | | Merge pull request #18877 from prathamesh-sonpatki/ar-changelog-typos-2Rafael Mendonça França2015-02-101-2/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fixed typos in ActiveRecord CHANGELOG [ci skip]
| * | | | | | | | Fixed typos in ActiveRecord CHANGELOG [ci skip]Prathamesh Sonpatki2015-02-111-2/+2
| | | | | | | | |