aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Do not recommend `xhr` since it is going to be deprecated.Guo Xiang Tan2015-02-131-3/+0
|
* Merge pull request #18919 from nerdrew/missing-rack-utils-requireArthur Nogueira Neves2015-02-121-0/+1
|\ | | | | require rack/utils in exception_wrapper
| * require rack/utils in exception_wrapperAndrew Lazarus2015-02-121-0/+1
|/
* remove meta programmingAaron Patterson2015-02-121-3/+3
| | | | | there's really no benefit here. It's the same number of lines without the meta programming and is faster
* there is always an integration session, so remove the checkAaron Patterson2015-02-121-1/+0
|
* lazily create the integration sessionAaron Patterson2015-02-122-11/+5
| | | | now we don't have to call reset! everywhere
* use before_setup to set up test instance variablesAaron Patterson2015-02-121-7/+6
|
* Skip url_helpers instead of caching, speed up integration testseileencodes2015-02-122-18/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We shouldn't cache if it's not absolutely necessary. Removes route caching and instead skips using the `url_helpers` is the integration test session doesn't require it. Benchmark ips on integration and controller index method tests below. Without any caching or changes to `#url_helpers`: ``` Calculating ------------------------------------- INDEX: Integration Test 71.000 i/100ms INDEX: Functional Test 99.000 i/100ms ------------------------------------------------- INDEX: Integration Test 728.878 (± 8.0%) i/s - 3.692k INDEX: Functional Test 1.015k (± 6.7%) i/s - 5.148k Comparison: INDEX: Functional Test: 1015.4 i/s INDEX: Integration Test: 728.9 i/s - 1.39x slower ``` With caching on `#url_helpers`: ``` Calculating ------------------------------------- INDEX: Integration Test 74.000 i/100ms INDEX: Functional Test 99.000 i/100ms ------------------------------------------------- INDEX: Integration Test 752.377 (± 6.9%) i/s - 3.774k INDEX: Functional Test 1.021k (± 6.7%) i/s - 5.148k Comparison: INDEX: Functional Test: 1021.1 i/s INDEX: Integration Test: 752.4 i/s - 1.36x slower ``` Afer removing the caching and bypassing the `url_helpers` when not necessary in the session: ``` Calculating ------------------------------------- INDEX: Integration Test 87.000 i/100ms INDEX: Functional Test 97.000 i/100ms ------------------------------------------------- INDEX: Integration Test 828.433 (± 6.4%) i/s - 4.176k INDEX: Functional Test 926.763 (± 7.2%) i/s - 4.656k Comparison: INDEX: Functional Test: 926.8 i/s INDEX: Integration Test: 828.4 i/s - 1.12x slower ```
* Merge pull request #18915 from kamipo/extract_date_time_precision_testRafael Mendonça França2015-02-124-271/+102
|\ | | | | Extract `DateTimePrecisionTest`
| * Extract `DateTimePrecisionTest`Ryuta Kamizono2015-02-134-271/+102
| | | | | | | | The datetime precision tests for any adapters is duplicated.
* | Optimize none? and one? relation query methods to use LIMIT and COUNT.Eugene Gilburg2015-02-126-2/+162
|/ | | | | | | | Use SQL COUNT and LIMIT 1 queries for none? and one? methods if no block or limit is given, instead of loading the entire collection to memory. The any? and many? methods already follow this behavior. [Eugene Gilburg & Rafael Mendonça França]
* Merge pull request #18844 from ↵Zachary Scott2015-02-121-0/+15
|\ | | | | | | | | yuki24/guides-add-render-example-without-partial-and-locals Add tip for skipping `partial` and `locals` options for `render`
| * Add tip for skipping `partial` and `locals` options for `render`Yuki Nishijima2015-02-081-0/+15
| | | | | | | | [ci skip]
* | Merge pull request #11790 from printercu/patch-3Rafael Mendonça França2015-02-123-14/+39
|\ \ | | | | | | | | | ActionController#translate supports symbols
| * | ActionController#translate also lookups shortcut without action nameMax Melentiev2013-10-223-4/+13
| | |
| * | ActionController#translate supports symbolsprintercu2013-09-253-12/+28
| | | | | | | | | | | | Made it similar to views helper.
* | | Merge pull request #18886 from kamipo/allow_precision_option_for_time_columnRafael Mendonça França2015-02-127-19/+90
|\ \ \ | | | | | | | | Allow `:precision` option for time type columns
| * | | Allow `:precision` option for time type columnsRyuta Kamizono2015-02-127-19/+90
| | | |
* | | | 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`