aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #22967 from schneems/schneems/generic-metadataSean Griffin2016-01-0817-14/+253
|\ | | | | Prevent destructive action on production database
| * Fixing tests and re-locating error checking.schneems2016-01-085-16/+17
| |
| * Fix kwarg to not have circular dependencyschneems2016-01-081-1/+1
| |
| * Use hash like syntax for InternalMetadataschneems2016-01-086-14/+12
| | | | | | | | Discussion: https://github.com/rails/rails/pull/22967#discussion_r49137035
| * Add EnvironmentMismatchErrorschneems2016-01-082-4/+25
| | | | | | Raise an error when a destructive action is made on a database where the current environment is different from the environment stored in the database.
| * Use `key` as primary key in schema.schneems2016-01-081-1/+1
| |
| * [ci skip] Add comment to remove silenced code.schneems2016-01-071-0/+1
| |
| * Prevent destructive action on production databaseschneems2016-01-0716-14/+232
| | | | | | | | | | | | | | This PR introduces a key/value type store to Active Record that can be used for storing internal values. It is an alternative implementation to #21237 cc @sgrif @matthewd. It is possible to run your tests against your production database by accident right now. While infrequently, but as an anecdotal data point, Heroku receives a non-trivial number of requests for a database restore due to this happening. In these cases the loss can be large. To prevent against running tests against production we can store the "environment" version that was used when migrating the database in a new internal table. Before executing tests we can see if the database is a listed in `protected_environments` and abort. There is a manual escape valve to force this check from happening with environment variable `DISABLE_DATABASE_ENVIRONMENT_CHECK=1`.
* | Merge pull request #22977 from rails/revert-22934-masterDavid Heinemeier Hansson2016-01-0815-46/+36
|\ \ | | | | | | Revert "Move async execution from celluloid to concurrent-ruby"
| * | Revert "Move async execution from celluloid to concurrent-ruby"David Heinemeier Hansson2016-01-0815-46/+36
|/ /
* | Merge pull request #22934 from mperham/masterDavid Heinemeier Hansson2016-01-0815-36/+46
|\ \ | | | | | | Move async execution from celluloid to concurrent-ruby
| * | don't need explicit dep and a pretty neat pickMike Perham2016-01-052-2/+1
| | |
| * | Use Module#thread_mattr_accessorMike Perham2016-01-051-8/+6
| | |
| * | Remove celluloid referencesMike Perham2016-01-056-6/+1
| | |
| * | Move async execution from celluloid to concurrent-rubyMike Perham2016-01-059-30/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes 8 runtime gem dependencies from Rails: ``` Using hitimes 1.2.3 Using timers 4.1.1 Using celluloid-essentials 0.20.5 Using celluloid-extras 0.20.5 Using celluloid-fsm 0.20.5 Using celluloid-pool 0.20.5 Using celluloid-supervision 0.20.5 Using celluloid 0.17.2 ```
* | | [doc] The capture method isn't always used inside views to create a variableAkira Matsuda & saya2016-01-081-2/+2
| | | | | | | | | | | | | | | but rather very often used inside helpers to directly return a String value. [ci skip]
* | | Merge pull request #22973 from kamipo/fix_select_values_method_signatureRafael França2016-01-082-4/+4
|\ \ \ | | | | | | | | Fix `select_values` method signature for consistency
| * | | Fix `select_values` method signature for consistencyRyuta Kamizono2016-01-082-4/+4
| | | |
* | | | Merge pull request #22971 from kamipo/insert_sql_is_almost_same_as_insertRafael França2016-01-084-25/+2
|\ \ \ \ | | | | | | | | | | `{update|delete}_sql` are almost the same as `{update|delete}`
| * | | | `{update|delete}_sql` are almost the same as `{update|delete}`Ryuta Kamizono2016-01-084-25/+2
| | | | | | | | | | | | | | | | | | | | Simply `{update|delete}_sql` aliases to `{update|delete}`.
* | | | | Merge pull request #22972 from prathamesh-sonpatki/fix-typoRafael França2016-01-081-1/+1
|\ \ \ \ \ | |_|/ / / |/| | | | Fix typo in ActionPack CHANGELOG [ci skip]
| * | | | Fix typo in ActionPack CHANGELOG [ci skip]Prathamesh Sonpatki2016-01-081-1/+1
|/ / / /
* | | | Merge pull request #18909 from ↵Sean Griffin2016-01-073-8/+24
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | davidcornu/fix-hash-with-indifferent-access-default Match HashWithIndifferentAccess#default & Hash#default
| * | | | Match HashWithIndifferentAccess#default's behaviour with Hash#defaultDavid Cornu2016-01-073-8/+24
|/ / / /
* | | | Merge pull request #22966 from mastahyeti/add_gregRafael França2016-01-071-1/+1
|\ \ \ \ | |/ / / |/| | | Fix changelog for per-form CSRF tokens
| * | | add gregBen Toews2016-01-071-1/+1
|/ / /
* | | Ensure `config.active_record.time_zone_aware_types` is always setSean Griffin2016-01-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | While the option on `ActiveRecord::Base` is always around, we need to explicitly set it on the config object. Otherwise the recommended configuration change results in an error. Fixes #22839
* | | Merge pull request #22942 from Edouard-chin/rake-routes-error-messageKasper Timm Hansen2016-01-073-7/+64
|\ \ \ | | | | | | | | Better error message when running `rake routes` with CONTROLLER arg:
| * | | Better error message when running `rake routes` with CONTROLLER arg:Edouard CHIN2016-01-073-7/+64
|/ / / | | | | | | | | | | | | | | | | | | - `CONTROLLER` argument can now be supplied in different ways (Rails::WelcomeController, Rails::Welcome, rails/welcome) - If `CONTROLLER` argument was supplied but it does not exist, will warn the user that this controller does not exist - If `CONTROLLER` argument was supplied and no routes could be found matching this filter, will warn the user that no routes were found matching the supplied filter - If no routes were defined in the config/routes.rb file, will warn the user with the original message
* | | Merge pull request #20109 from prathamesh-sonpatki/keep-only-one-rootKasper Timm Hansen2016-01-071-21/+21
|\ \ \ | | | | | | | | Remove original root method from Base module and kept overridden implementation in Resources module.
| * | | Kept overridden root method and removed original methodPrathamesh Sonpatki2016-01-071-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The root method is defined and documented in Base module and decorated in Resources module. - The documentation in Base module actually talks about method signature of decorated method from Resources module. - Argument handling was moved to decorated method in https://github.com/rails/rails/commit/977455cc2efb94f40b4c0d46d1842be198ed7c4c to handle options such as :as with directly passed path parameter. - To avoid the confusion, removed original root method from Base module and only kept overridden version in Resources module. - References - https://github.com/rails/rails/pull/12208 & https://github.com/rails/rails/pull/12208#issuecomment-24350897.
* | | | Merge pull request #22956 from prathamesh-sonpatki/rm-splat-warningKasper Timm Hansen2016-01-071-1/+1
|\ \ \ \ | | | | | | | | | | Remove splat operator warning from ssl_test
| * | | | Remove splat operator warning from ssl_testPrathamesh Sonpatki2016-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Removes following warning - `rails/actionpack/test/dispatch/ssl_test.rb:203: warning: `*' interpreted as argument prefix`.
* | | | | Merge pull request #22949 from schneems/schneems/request-idDavid Heinemeier Hansson2016-01-072-1/+19
|\ \ \ \ \ | |/ / / / |/| | | | Default new apps to tag logs with `request_id`
| * | | | Default new apps to tag logs with `request_id`schneems2016-01-062-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In high volume applications it can be very difficult to figure out what is happening in logs because each request is not easily identified. For example 3 requests could look something like this: ``` Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:21 +0000 Rendered welcome/index.html.erb within layouts/application (0.1ms) Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:22 +0000 Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:23 +0000 Rendered welcome/index.html.erb within layouts/application (0.1ms) Processing by WelcomeController#index as HTML Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms) Processing by WelcomeController#index as HTML Rendered welcome/index.html.erb within layouts/application (0.1ms) Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms) Processing by WelcomeController#index as HTML Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms) ``` The `:request_id` log tag ensures that each request is tagged with a unique identifier. While they are still interleaved it is possible to figure out which lines belong to which requests. Like: ``` [c6034478-4026-4ded-9e3c-088c76d056f1] Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:21 +0000 [c6034478-4026-4ded-9e3c-088c76d056f1] Rendered welcome/index.html.erb within layouts/application (0.1ms) [abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:22 +0000 [acfab2a7-f1b7-4e15-8bf6-cdaa008d102c] Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:23 +0000 [abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Rendered welcome/index.html.erb within layouts/application (0.1ms) [c6034478-4026-4ded-9e3c-088c76d056f1] Processing by WelcomeController#index as HTML [c6034478-4026-4ded-9e3c-088c76d056f1] Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms) [abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Processing by WelcomeController#index as HTML [abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Rendered welcome/index.html.erb within layouts/application (0.1ms) [abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms) [acfab2a7-f1b7-4e15-8bf6-cdaa008d102c] Processing by WelcomeController#index as HTML [acfab2a7-f1b7-4e15-8bf6-cdaa008d102c] Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms) ``` Now if you have the logs and you find this unique ID you can filter to only look at information from that request. So a filtered log output would be very clear: ``` [c6034478-4026-4ded-9e3c-088c76d056f1] Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:21 +0000 [c6034478-4026-4ded-9e3c-088c76d056f1] Rendered welcome/index.html.erb within layouts/application (0.1ms) [c6034478-4026-4ded-9e3c-088c76d056f1] Processing by WelcomeController#index as HTML [c6034478-4026-4ded-9e3c-088c76d056f1] Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms) ``` In addition to this benefit the `:request_id` can be set via the `X-Request-ID` header so that the same request could be traced between multiple components. For example a request comes in Nginx (or another load balancer) could assign a request id. As the load balancer processes the request I can log using that id, then when the request is passed on to Rails, the same id is used. That way if a problem is determined to be not caused in Rails it could be traced back to other components with the same ID. You can set a value in nginx for example using something like this: ``` location / { proxy_pass http://upstream; proxy_set_header X-Request-Id $pid-$msec-$remote_addr-$request_length; } # http://stackoverflow.com/questions/17748735/setting-a-trace-id-in-nginx-load-balancer ``` Heroku sets this header value so problems like timeouts that are logged by like router can be traced back to specific request within the application. Whether you are using components that are setting request ID or not, all production applications can benefit from the additional debugging information of having a unique identifier for all requests. This change will only affect new applications, anyone can opt out by commenting or removing the line in `config/production.rb`.
* | | | | Merge pull request #22903 from ↵Rafael França2016-01-073-2/+40
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | prathamesh-sonpatki/allow-ac-parameters-hash-as-an-argument-to-routes Allow AC::Parameters as an argument to url_helpers
| * | | | | Allow AC::Parameters as an argument to url_helpersPrathamesh Sonpatki2016-01-073-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Earlier only Hash was allowed as params argument to url_helpers. - Now ActionController::Parameters instances will also be allowed. - If the params are not secured then it will raise an ArgumentError to indicate that constructing URLs with non-secure params is not recommended. - Fixes #22832.
* | | | | | Merge pull request #22954 from yui-knk/suppress_warning_on_action_viewRafael França2016-01-071-0/+1
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Suppress warning (instance variable @persisted not initialized)
| * | | | | Suppress warning (instance variable @persisted not initialized)yui-knk2016-01-071-0/+1
|/ / / / /
* | | | | Merge pull request #22952 from Baron-burton/contributing_documentationRafael França2016-01-061-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Typo in Contributing.md documentation
| * | | | | Typo in Contributing.md documentationBaron-burton2016-01-061-1/+1
|/ / / / / | | | | | | | | | | | | | | | Just fixed a small typo in the documentation.
* | | | | Merge pull request #22948 from kamipo/remove_delete_sql_in_sqlite3_adapterRafael França2016-01-061-5/+0
|\ \ \ \ \ | |/ / / / |/| | | | Remove `delete_sql` in sqlite3 adapter
| * | | | Remove `delete_sql` in sqlite3 adapterRyuta Kamizono2016-01-071-5/+0
|/ / / / | | | | | | | | | | | | | | | | `sql += " WHERE 1=1"` was introduced in 69cb942. But it is not needed. ref https://www.sqlite.org/lang_delete.html
* | | | Merge pull request #22945 from kamipo/refactor_connection_insert_sqlRafael França2016-01-064-35/+10
|\ \ \ \ | | | | | | | | | | Refactor `connection.insert_sql`
| * | | | Refactor `connection.insert_sql`Ryuta Kamizono2016-01-074-35/+10
|/ / / / | | | | | | | | | | | | `connection.insert_sql` is almost the same as `connection.insert`.
* | | | Merge pull request #22933 from schneems/schneems/fix-broadcastRichard Schneeman2016-01-066-50/+48
|\ \ \ \ | | | | | | | | | | [close #22917] Don't output to `STDOUT` twice
| * | | | Remove unused instance variableschneems2016-01-061-1/+0
| | | | |
| * | | | [close #22917] Don't output to `STDOUT` twiceschneems2016-01-064-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When `rails console` or `rails server` are used along with a logger set to output to `STDOUT` then the contents will show up twice. This happens because the logger is extended with `ActiveSupportLogger.broadcast` with a destination of STDOUT even if it is already outputting to `STDOUT`. Previously PR #22592 attempted to fix this issue, but it ended up causing NoMethodErrors. A better approach than relying on adding a method and flow control is to inspect the log destination directly. For this `ActiveSupport::Logger.logger_outputs_to?` was introduced ```ruby logger = Logger.new(STDOUT) ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) # => true ``` To accomplish this we must look inside of an instance variable of standard lib's Logger `@logdev`. There is a related Ruby proposal to expose this method in a standard way: https://bugs.ruby-lang.org/issues/11955
| * | | | Revert "Add Logger option to disable message broadcasts"schneems2016-01-053-45/+22
| | |/ / | |/| | | | | | | | | | This reverts related commits due to #22917.
* | | | Merge pull request #22941 from lsylvester/pg-remove-index-legacyMatthew Draper2016-01-072-2/+19
|\ \ \ \ | | | | | | | | | | Fix remove_index for postgresql when running legacy migrations