aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Separate the constraint and other options [ci skip]Robin Dupret2015-07-011-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only one constraint option can be used at a time (except for the minimum and maximum ones that can eventually be combined). However, other options can be used with them (e.g. the validation failure message). So let's make the distinction between these two different options categories. [Yves Senn, Matthew Draper & Robin Dupret]
* | | | | Merge pull request #20747 from pwnall/fix_minitest_railsKasper Timm Hansen2015-07-011-3/+3
|\ \ \ \ \ | | | | | | | | | | | | Avoid crashing when minitest-rails is loaded.
| * | | | | Avoid crashing when minitest-rails is loaded.Victor Costan2015-07-011-3/+3
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The improvments to the test runner's integration with minitest in commit b6fc8e25a10cc4abdd03018798b180270d6c5d7f add methods to the Minitest module that refer to the Rails module. Unfortunately, when the minitest-rails gem is loaded, the reference is incorrectly resolved to the Minitest::Rails module.
* | | | | Correct through associations using scopesSean Griffin2015-06-304-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The changes introduced to through associations in c80487eb were quite interesting. Changing `relation.merge!(scope)` to `relation = relation.merge(scope)` should in theory never cause any changes in behavior. The subtle breakage led to a surprising conclusion. The old code wasn't doing anything! Since `merge!` calls `instance_exec` when given a proc, and most scopes will look something like `has_many :foos, -> { where(foo: :bar) }`, if we're not capturing the return value, it's a no-op. However, removing the `merge` causes `unscope` to break. While we're merging in the rest of the chain elsewhere, we were never merging in `unscope` values, causing a breakage on associations where a default scope was being unscoped in an association scope (yuk!). This is subtly related to #20722, since it appears we were previously relying on this mutability. Fixes #20721. Fixes #20727.
* | | | | follow-up to 2183caa, always reenable the task. #20743Yves Senn2015-06-301-3/+3
| | | | |
* | | | | `dump_schema_after_migration` applies migration tasks other than db:migrateYves Senn2015-06-303-15/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #20743. The task `db:_dump` now only dumps the schema if `ActiveRecord::Base.dump_schema_after_migration` is true. This has effects: - `db:migrate:up` - `db:migrate:down` - `db:forward` - `db:rollback`
* | | | | tests, railties tests should use `bin/` executables when possible.Yves Senn2015-06-309-121/+121
| | | | | | | | | | | | | | | | | | | | | | | | | We recommend using the `bin/` executables in our docs and guides. Let's make sure that our tests execute the same code path.
* | | | | Merge pull request #20741 from radar/integration_tool_docRafael Mendonça França2015-06-301-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Improve integration_tool documentation
| * | | | | integration_tool defaults to :test_unitRyan Bigg2015-06-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per railties/lib/rails/test_unit/railtie.rb, where it sets it explicitly. This can be confirmed by starting a new Rails console session in a new app and running this code: Rails.application.config.app_generators.rails[:integration_tool] I also beefed up the documentation slightly to be more explicit about what this configuration setting does.
* | | | | | Merge pull request #20734 from srikanthps/masterRafael Mendonça França2015-06-291-1/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | To fix #20644
| * | | | | | To fix #20644Srikanth Shreenivas2015-06-301-1/+2
| | | | | | | | | | | | | | | | | | | | | Added a note on development kit for Windows Users. This is required as Windows users can get frustrated when their first rails project creation would fail as some native gem won't get built.
* | | | | | | Merge pull request #20739 from jordondornbos/patch-1Rafael Mendonça França2015-06-291-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | fix pluralization in doc [ci skip]
| * | | | | | | fix pluralization in doc [ci skip]Jordon Dornbos2015-06-291-1/+1
|/ / / / / / /
* | | | | | | Merge pull request #20735 from vngrs/minor_addition_to_getting_startedSean Griffin2015-06-291-2/+2
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | Minor addition to getting started guide for foreign_key description
| * | | | | | Minor addition to getting started guide for foreign_key description of ↵Mehmet Emin İNAÇ2015-06-291-2/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | references migration [ci skip]
* | | | | | docs, nodoc `NullPreloader` and `AlreadyLoaded`.Yves Senn2015-06-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These classes are part of Active Record Preloader, which is not part of the public API.
* | | | | | Merge pull request #20724 from y-yagi/fix_scaffold_in_full_engineYves Senn2015-06-297-3/+36
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | fix NoMethodError that occurs when generating scaffold inside full mode engine
| * | | | | | fix NoMethodError that occurs when generating scaffold inside full mode engineyuuji.yaginuma2015-06-287-3/+36
| | | | | | |
* | | | | | | Merge pull request #20669 from akolomiychuk/image-pathYves Senn2015-06-293-0/+11
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Passing nil to image_tag
| * | | | | | | Add nil check in asset_pathAnton Kolomiychuk2015-06-292-0/+7
| | | | | | | |
* | | | | | | | Merge pull request #20538 from repinel/fix-render-caching-issueKasper Timm Hansen2015-06-294-16/+36
|\ \ \ \ \ \ \ \ | |_|_|_|_|/ / / |/| | | | | | | Fix cache issue when different partials use the same collection
| * | | | | | | Fix cache issue when different partials use the same collectionRoque Pinel2015-06-284-16/+36
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the `virtual_path` option to `cache_fragment_name` so it can be provided when needed. That allows `cache_collection_render` to get the appropriate cache key with the digest generated based on the template and prevent collision with other templates that cache the same collection.
* | | | | | | Merge pull request #20726 from yui-knk/fix/doc_controllerClaudio B.2015-06-281-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | [ci skip] Fix action_controller_overview
| * | | | | | | [ci skip] Fix action_controller_overviewyui-knk2015-06-281-1/+1
|/ / / / / / /
* | | | | | | updates a migration example in the Getting Started guide [ci skip]Xavier Noria2015-06-281-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #20705.
* | | | | | | Revert the behavior of association names and `where` to be closer to 4.2Sean Griffin2015-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, we will always assume the association name is the same as the table it's referencing. This is subtly different than treating the hash key passed to `where` as the table name, as it still allows the class referenced by the association to provide additional type information. After exploring several possible solutions to the ambiguity problem, I do not think there is a short term answer that will maintain backwards compatibility. This change will make it so the following code does not work: class User has_many :approved_posts, -> { where(approved: true) }, class_name: "Post" end User.where(approved_posts: { id: 1 }) But prevents potential ambiguity and collision as demonstrated in [this gist](https://gist.github.com/senny/1ae4d8ea7b0e269ed7a0). Unfortunately, truely solving this requires significantly re-architecting this code, so that what is currently represented as an `Arel::Attribute` is instead another data structure that also references the association it is representing, so we can identify the proper table name for aliasing when we construct the final tree. While I'd still like to accomplish that in the long run, I don't think I'll be able to get there in time for Rails 5 (since I'm not full time OSS any more, and this is several weeks worth of work). I'm hoping to achieve this for Rails 5.1. Fixes #20308
* | | | | | | Improve error messages in cookies_testeileencodes2015-06-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using `assert_predicate` and `assert_match` instead of just `assert` is preferrable because better error messages are output. In the case of `assert response.cookies.empty?` the error message was `Failed assertion, no message given.` but now with `assert_predicate` it will be `Expected {"user_name"=>"david"} to be empty?.` For `assert_match(/user_name=david/, response.headers["Set-Cookie"])` as well, the message returned was unhelpful - `Failed assertion, no message given.` but now will tell what was expected and what was returned with `Expected /user_name=david/ to match "user_name=nope; path=/".`
* | | | | | | Merge pull request #20276 from davetron5000/revert-head-on-no-templateKasper Timm Hansen2015-06-272-2/+38
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Allow default_render to take a block to customize behavior when there's no template
| * | | | | | | Override default_render's behavior with a blockDave Copeland2015-06-202-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 0de4a23 the behavior when there is a missing template was changed to not raise an error, but instead head :no_content. This is a breaking change and some gems rely on this happening. To allow gems and other code to work around this, allow `default_render` to take a block which, if provided, will execute the contents of that block instead of doing the `head :no_content`.
* | | | | | | | Merge pull request #20720 from rohandaxini/patch-2Rafael Mendonça França2015-06-271-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Maintaining consistency in wording [ci skip]
| * | | | | | | | Maintaining consistency in wordings [ci skip]Rohan Daxini2015-06-271-1/+1
|/ / / / / / / / | | | | | | | | | | | | | | | | "reproduce" word is better suited then "replicate" as its also used at other places in this same document having same context. It will then be consistent across document.
* | | | | | | | Merge pull request #20712 from nhodges/dev/nh/20345Rafael Mendonça França2015-06-271-2/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Remove `config` options from `default_options` in `railties`
| * | | | | | | | Remove `config` options from `default_options` in `railties`Nuri Hodges2015-06-261-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #20345.
* | | | | | | | | Merge pull request #20556 from radanskoric/improve-validation-helpersRafael Mendonça França2015-06-275-7/+41
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Improve Validation Helpers' documentation comments and tests
| * | | | | | | | | Improve Validation Helpers' documentation comments and testsRadan Skoric2015-06-275-7/+41
|/ / / / / / / / /
* | | | | | | | | Merge pull request #20652 from ankit1910/change_docZachary Scott2015-06-271-2/+12
|\ \ \ \ \ \ \ \ \ | |_|_|_|/ / / / / |/| | | | | | | | Change documentation for collection.build and collection.create [ci-skip]
| * | | | | | | | Change documentation for collection.build and collection.create [ci-skip]ankit19102015-06-211-2/+12
| | | | | | | | |
* | | | | | | | | Merge pull request #20607 from cmtonkinson/update-console-colorsRafael Mendonça França2015-06-271-8/+11
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | More granular console SQL coloration
| * | | | | | | | | More granular console SQL colorationChris Tonkinson2015-06-231-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new coloration approach makes it easier to scan the rails console for specific types of activity with more fine-grained visual cues. Virtual terminal ANSI color escape codes are used when displaying SQL statements in the rails console. The former implementation alternates line prefix information (including the statement name and execution latency) between CYAN and MAGENTA. This visually differentiates any SQL statements in the log and is useful for quickly scanning for database activity. While a great idea and a solid foundation, alternating between just two colors on an even/odd basis (much like striping an HTML table) can be improved upon. This patch replaces the even/odd striping with a more comprehensive scheme that applies coloration based on the type of statement being run. Every statement logged has its prefix (name and latency) colored white (as the statement body was previously). The statement body is now colored according to the nature of the statement: - INSERT statements are GREEN (symbolic of creation or genesis) - SELECT statements are BLUE (typically used for informational displays, as SELECT statements do not normally have side-effects) - DELETE statements are RED (commonly used to indicate the danger of a destructive action) - UPDATE statements are YELLOW (it's like a less extreme RED :P) - TRANSACTION statements are CYAN (arbitrary) - and any other statements are MAGENTA (again, arbitrary)
* | | | | | | | | | Merge pull request #20699 from ↵Rafael Mendonça França2015-06-273-2/+37
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vngrs/foreign_key_with_table_name_suffix_and_prefix Add table name prefix and suffix support for foreign keys
| * | | | | | | | | | Add table name prefix and suffix support to add_foreign_key and ↵Mehmet Emin İNAÇ2015-06-253-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | remove_foreign_key methods fix tests
* | | | | | | | | | | Merge pull request #20018 from sikachu/change-column-default-recorderRafael Mendonça França2015-06-2710-13/+72
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Add reversible syntax for change_column_default
| * | | | | | | | | | | Update guide for new change_column_default syntaxPrem Sichanugrist2015-06-261-6/+8
| | | | | | | | | | | |
| * | | | | | | | | | | Add reversible syntax for change_column_defaultPrem Sichanugrist2015-06-269-7/+64
| | |_|_|_|_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing `:from` and `:to` to `change_column_default` makes this command reversible as user has defined its previous state. So, instead of having the migration command as: change_column_default(:posts, :state, "draft") They can write it as: change_column_default(:posts, :state, from: nil, to: "draft")
* | | | | | | | | | | Merge pull request #20711 from fenec/fix_routes_in_guidesRafael Mendonça França2015-06-271-0/+1
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Change routes.rb look in getting started
| * | | | | | | | | | | Change routes.rb look in getting started [ci skip]Dmitry Pak2015-06-271-0/+1
| | |_|_|_|/ / / / / / | |/| | | | | | | | |
* | | | | | | | | | | Merge pull request #20714 from y-yagi/fix_file_fixture_pathRafael Mendonça França2015-06-271-1/+1
|\ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / |/| | | | | | | | | | correct `file_fixture_path` in plugins `test_helper.rb`
| * | | | | | | | | | correct `file_fixture_path` in plugins `test_helper.rb`yuuji.yaginuma2015-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `fixture_path` does not end with a slash
* | | | | | | | | | | Merge pull request #20417 from dubek/fix-template-cache-call-patternKasper Timm Hansen2015-06-263-1/+36
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Improve detection of partial templates eligible for collection caching.
| * | | | | | | | | | | Improve detection of partial templates eligible for collection caching.Dov Murik2015-06-223-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The regular expression which was used to detect partial templates that begin with a `<% cache ... do %>` call missed some cases. This commits attempts to improve the detection for some cases such as multi-line comments at the beginning of the template. The different templates are listed in two new unit test methods. Note that specially crafted Ruby code can still evade such `cache`-call detection: for example, a user might have its own method which itself calls the Rails `cache` helper. In such a case, the template's code doesn't start with a literal `cache` string and therefore will not be eligible for collection caching.