aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application
Commit message (Collapse)AuthorAgeFilesLines
* Correctly check whether key is defined in configurationyuuji.yaginuma2017-03-191-3/+3
| | | | | | | | | | | | | It can not check correctly with `defined?` ```ruby irb(main):001:0> Rails.application.config.active_record => {:maintain_test_schema=>true, :belongs_to_required_by_default=>true} irb(main):002:0> defined?(Rails.application.config.active_record) => nil ``` Follow up to #28469
* Track the version-compatible config settings inside railtiesMatthew Draper2017-03-181-0/+28
| | | | | | | | | | | | | | | | Instead of forcing new applications to carry an initializer that just switches things to what their default "should" be, we can handle it internally. The initializer is then only used by upgraders: it shows what the new default would be (commented out), while their upgraded application continues to operate as it did before. Under this model, a multiply-upgraded application could accumulate several new_framework_defaults_*.rb files, for each release series it has traversed. A given release series only needs to generate the latest, though, because we don't support `rails app:upgrade` while skipping releases.
* Revert "Revert "Add encrypted secrets""Kasper Timm Hansen2017-02-232-2/+10
|
* Revert "Add encrypted secrets" (#28127)David Heinemeier Hansson2017-02-232-10/+2
|
* Add encrypted secrets (#28038)Kasper Timm Hansen2017-02-232-2/+10
|
* Merge pull request #27647 from Shopify/fully-eagerload-journeyRafael França2017-01-302-1/+17
|\ | | | | Fully initialize routes before the first request is handled
| * Fully initialize routes before the first request is handledJean Boussier2017-01-182-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | `AD::Journey::GTG::Simulator` is lazily built the first time `Journey::Router#find_routes` is invoked, which happens when the first request is served. On large applications with many routes, building the simulator can take several hundred milliseconds (~700ms for us). Triggering this initialization during the boot process reduces the impact of deploys on the application response time.
* | Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-2/+2
| | | | | | | | (I personally prefer writing one string in one line no matter how long it is, though)
* | Merge pull request #27652 from y-yagi/remove_unused_requireRafael França2017-01-111-2/+0
|\ \ | |/ |/| remove unused requires
| * remove unused requiresyuuji.yaginuma2017-01-121-2/+0
| | | | | | | | Related to 0129ca2eeb6d5b2ea8c6e6be38eeb770fe45f1fa, f7782812f7e727178e4a743aa2874c078b722eef, f9ed83321ac1d1902578a0aacdfe55d3db754219
* | Current default Rails app encoding "utf-8" looks more like a W3C charset ↵Akira Matsuda2017-01-111-1/+1
|/ | | | than a ruby encoding
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Remove deprecated config.serve_static_filesRafael Mendonça França2017-01-031-19/+0
|
* Remove deprecated `config.static_cache_control`Rafael Mendonça França2017-01-032-13/+1
|
* Enforce middleware ordering with a test, instead of commentsMatthew Draper2016-12-311-3/+1
| | | | | | | | | We want the actual order to be very predictable, so it's rightly defined in code -- not with an on-the-fly tsort. But we can do the tsort here, and then verify that it matches the implemented ordering. This way we don't leave future readers guessing which parts of the ordering are deliberate and which are arbitrary.
* Allow log remote ip addres when config.action_dispatch.trusted_proxies passedLeonid Batizhevsky2016-12-301-1/+2
|
* code gardening: removes redundant selfsXavier Noria2016-08-081-2/+2
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* applies new string literal convention in railties/libXavier Noria2016-08-064-20/+20
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Suppress warningsyui-knk2016-07-311-0/+1
| | | | | | | This commit suppressed `warning: instance variable @session_store not initialized`. e5a6f7ee9e951dbe0e4e9ea2c0743b4dfb135c57 introduced these warnings.
* Merge pull request #25438 from prathamesh-sonpatki/rm-session-store-initializerRafael Mendonça França2016-07-202-11/+25
|\ | | | | | | Setup default session store internally, no longer through an initializer
| * Setup default session store internally, no longer through an application ↵Prathamesh Sonpatki2016-07-172-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | initializer - By default the session store will be set to cookie store with application name as session key. - Older apps are not affected as they will have the session store initializer generated by Rails in older versions, and Rails will not overwrite the session store if it is already set or disabled. - But new apps will not have the initializer, instead the session store will be set to cookie store by default. - Based on comment by DHH here - https://github.com/rails/rails/issues/25181#issuecomment-222312764.
| * Refactor the existing session_store to use keyword args and raise early when ↵Prathamesh Sonpatki2016-07-171-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | set to activerecord session store - Use keyword args as it is possible to use them now. - The error message for activerecord-session_store gem was added in 1807384. - But it was added for a code path which gets called when we try to **access** the session store, not when we **set** it. - So the test expecting the exception started failing because now the session store is set via railtie again **after** setting it first with :active_record_store in the test. - As the error is not raised while setting the store to :active_record_store, the store gets overwritten by railtie and when we access it via `session_store` while building the default middleware stack, the exception is not raised. - This commit moves the code for raising the exception to the path where we try to set the store.
| * Introduce a new method for checking whether session_store is set by user or ↵Prathamesh Sonpatki2016-07-171-0/+4
|/ | | | | | | | | | | by Rails - We need to ability to check whether the session store it is set or not so that we can set it ourselves in an internal initializer. - We can't rely on return value of `config.session_store` as it can return `nil` when set to `disabled` and we will accidentally override it and set to default cookie store. - So introduced new method which just tells us whether it is set or not.
* implement respond_to_missing? to match method_missingDavid Feldman2016-07-051-0/+4
|
* Initialize the configuration with a valueRafael Mendonça França2016-06-221-1/+2
| | | | | | | This will fix the failures fixed by 41488adbb89a09fa96188486f8414842ff28c848 and keep this new option that is semi-private outside of the generated configurations
* Add option to enable dependency loading in productionRafael Mendonça França2016-06-221-1/+1
| | | | | | | | This will make easier to applications that rely on having const_missing hooks in production upgrade to Rails 5. This option is going to be remove in the future and the default behavior will be to disable the dependency loading.
* Fix rails/info routes for apps with globbing routeNicholas Firth-McCoy2016-06-201-1/+4
| | | | | | | | The /rails/info routes were inaccessible in apps with a catch-all globbing route, as they were being appended after the globbing route and would never be matched. See also ccc3ddb7762bae0df7e2f8d643b19b6a4769d5be.
* `behaviour` --> `behavior`Jon Moss2016-05-271-1/+1
| | | | http://edgeguides.rubyonrails.org/api_documentation_guidelines.html#english
* Merge pull request #24490 from ↵Santiago Pastorino2016-04-111-3/+3
|\ | | | | | | | | prathamesh-sonpatki/add-config-to-deprecation-warning Add `config` to the deprecation warnings of deprecated config options
| * Add `config` to the deprecation warnings of deprecated config optionsPrathamesh Sonpatki2016-04-101-3/+3
| |
* | revises fileutils dependencies in railtiesXavier Noria2016-04-111-3/+4
|/ | | | | | With the exception of what is loaded in active_support/rails, each file is responsible for its own dependencies. You cannot rely on runtime order of execution.
* Directly support stateful executor hooksMatthew Draper2016-04-051-13/+26
| | | | Also, make sure to call the +complete+ hooks if +run+ fails.
* Merge pull request #24332 from blackchestnut/doc/deprecation_warnSantiago Pastorino2016-04-041-2/+2
|\ | | | | Added 'config.' to deprecation warning
| * Added 'config.' to deprecation warningAlexander Kalinichev2016-03-261-2/+2
| | | | | | | | Misc: `config.public_file_server.enabled = true` instead `public_file_server.enabled = true`
* | Publish AS::Executor and AS::Reloader APIsMatthew Draper2016-03-022-32/+63
| | | | | | | | | | | | These should allow external code to run blocks of user code to do "work", at a similar unit size to a web request, without needing to get intimate with ActionDipatch.
* | Add `internal` attribute to routesJon Moss2016-02-221-4/+4
|/ | | | | | | | | | | | | | This is meant to provide a way for Action Cable, Sprockets, and possibly other Rack applications to mark themselves as internal, and to exclude themselves from the routing inspector, and thus `rails routes` / `rake routes`. I think this is the only way to have mounted Rack apps be marked as internal, within AD/Journey. Another option would be to create an array of regexes for internal apps, and then to iterate over that everytime a request comes through. Also, I only had the first `add_route` method set `internal`'s default to false, to avoid littering it all over the codebase.
* Always obtain the lock and do the unloadMatthew Draper2016-02-021-1/+1
| | | | | | We mostly care about `reload_classes_only_on_change=true`, because that's the default... and there, we definitely need to wait for the lock when necessary.
* Flexible configuration for ActionDispatch::SSLTim Rogers2015-12-291-1/+1
|
* let config.file_watcher be the way to enable the evented file watcherXavier Noria2015-12-131-17/+12
| | | | | | | | | | | Before this commit, the sole presence of the Listen constant enabled the evented file watcher (unless listen resorted to the polling backend). This way, applications may depend on listen for other stuff independently of this feature. Also, allows teams with mixed setups to decide at boot time whether the evented watcher should be enabled for each particular instance.
* Make debug_exception_response_format config depends on api_only when is not setJorge Bejar2015-12-091-2/+12
|
* debug_exception_response_format needs to be writeable in ConfigurationJorge Bejar2015-12-091-2/+2
|
* DebugException initialize with a response_format valueJorge Bejar2015-12-091-1/+1
|
* Add debug_exception_response_format config to configure DebugExceptionJorge Bejar2015-12-091-30/+31
| | | | behavior
* Response when error should be formatted properly in Rails API if local requestJorge Bejar2015-12-091-1/+1
|
* Disable FileEventedUpdateChecker for nowRafael Mendonça França2015-12-041-5/+1
| | | | | Railsties tests are broken with this new update checker so we will use the old one until we have the tests fixed.
* Make the `static_index` config part of the `config.public_server` configYuki Nishijima2015-11-162-3/+3
| | | | Also call it `public_server.index_name` so it'll make more sense.
* encapsulates the logic to choose the file monitor in app configXavier Noria2015-11-101-1/+9
|
* implements an evented file update checker [Puneet Agarwal]Xavier Noria2015-11-081-1/+1
| | | | | | | | | | | | This is the implementation of the file update checker written by Puneet Agarwal for GSoC 2015 (except for the tiny version of the listen gem, which was 3.0.2 in the original patch). Puneet's branch became too out of sync with upstream. This is the final work in one single clean commit. Credit goes in the first line using a convention understood by the contrib app.
* Fix `static_cache_control` deprecation warningJon Atack2015-11-051-3/+6
| | | | | | | | | | | | | | | | | | | | | | 1. Fix the message by wrapping the value in missing quotes and adding the missing backtick at the end. Finally, :lipstick: by adding a space inside the curly braces. Before: `config.public_file_server.headers = {'Cache-Control' => public, max-age=31536000} Now: `config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=31536000' }` 2. Display `static_cache_control` instead of static_cache_control. This follows what the 2 neighboring methods are doing. 3. Use strip_heredoc to improve the code formatting and readability like the 2 neighboring methods and wrap to 80 characters.
* Add enabled flag to the public file server.Kasper Timm Hansen2015-11-032-3/+24
| | | | | | | | As discussed in https://github.com/rails/rails/pull/19135#issuecomment-153385986. Replaces `serve_static_files` to unify the static options under the `public_file_server` wing. Deprecates `serve_static_files` accessors, but make them use the newer config internally.