aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/request/session.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Add changelog entry for #32446bogdanvlviv2018-04-061-2/+2
| | | | | | | In #32446 was added method `dig` to `session`. Improve docs of method `dig`. [ci skip]
* Add #dig to ActionDispatch::Request::Sessionclaudiob2018-04-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary The `session` object is not a real Hash but responds to many methods of Hash such as `[]`, `[]`, `fetch`, `has_key?`. Since Ruby 2.3, Hash also supports a `dig` method. This commit adds a `dig` method to `ActionDispatch::Request::Session` with the same behavior as `Hash#dig`. This is useful if you store a hash in your session, such as: ```ruby session[:user] = { id: 1, avatar_url: "http://example.org/nyancat.jpg" } ``` Then you can shorten your code from `session[:user][:avatar_url]` to `session.dig :user, :avatar_url`. ### Other Information I cherry-picked a commit from https://github.com/rails/rails/pull/23864, and modify a bit. The changes are below: * Converts only the first key to a string adjust to the `fetch` method. * Fixes a test case because we cannot use the indifferent access since ee5b621e2f8fde380ea4bc75b0b9d6f98499f511.
* Consistent behavior for session and cookies with to_h and to_hash methodIgor Kasyanchuk2018-01-311-0/+1
|
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Add lazy loading to #keys and #values methods in Sessioncodeforkjeff2017-04-261-0/+2
| | | | | | | This fixes a bug where session.keys and session.values return an empty array unless one of the other methods that does lazy loading from the underlying store is called first. #keys and #values should also call #load_for_read!
* [docs] fix ActionDispatch documentationHrvoje Šimić2017-03-131-4/+4
|
* Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-131-1/+1
|\ | | | | Add missing `+` around a some literals.
| * Add missing `+` around a some literals.bogdanvlviv2016-10-271-1/+1
| | | | | | | | | | | | Mainly around `nil` [ci skip]
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-3/+3
|/
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-17/+17
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Ensure compatibility between ActionDispatch::Request::Session and RackJon Moss2016-05-041-1/+5
| | | | | | | | | | | | | | Adding the `each` method is required for ensuring compatibility between Rails, and other Rack frameworks (like Sinatra, etc.), that are mounted within Rails, and wish to use its session tooling. Prior to this, there was an inconsistency between ActionDispatch::Request::Session and Rack::Session::Cookie, due to the absence of the `each` method. This should hopefully fix that error. :) For a full integration test with Sinatra and a standalone Rack application, you can check out the gist for that here: https://gist.github.com/maclover7/08cd95b0bfe259465314311941326470. Solves #15843.
* Revert "Merge pull request #20851 from tomprats/indifferent-sessions"Matthew Draper2016-02-261-2/+2
| | | | | | | This reverts commit 22db455dbe9c26fe6d723cac0758705d9943ea4b, reversing changes made to 40be61dfda1e04c3f306022a40370862e3a2ce39. This finishes off what I meant to do in 6216a092ccfe6422f113db906a52fe8ffdafdbe6.
* Revert "Update Session to utilize indiffernt access"Matthew Draper2016-02-261-8/+14
| | | | | | | | | | | This reverts commit 45a75a3fcc96b22954caf69be2df4e302b134d7a. HWIAs are better than silently deeply-stringified hashes... but that's a reaction to a shortcoming of one particular session store: we should not break the basic behaviour of other, more featureful, session stores in the process. Fixes #23884
* Update Session to utilize indiffernt accessTom Prats2016-01-301-14/+8
|
* Update session to have indifferent accessTom Prats2016-01-291-2/+2
|
* Fix typo in docs [ci skip]Rebecca Skinner2016-01-141-2/+2
|
* Space OddityAkira Matsuda2016-01-141-2/+2
| | | | | Converting nbsp(\u{00A0}) to the normal ASCII space(\u{0020}) [ci skip]
* stop using deprecated Abstract::ID classAaron Patterson2015-09-041-1/+1
|
* stop inheriting from Rack::RequestAaron Patterson2015-09-041-1/+1
| | | | | | Just include the modules necessary in the Request object to implement the things we need. This should make it easier to build delegate request objects because the API is smaller
* use a request object in the session middlewareAaron Patterson2015-08-221-22/+22
| | | | | This commit allows us to use one request object rather than allocating multiple request objects to deal with the session.
* point at rack masterAaron Patterson2015-08-201-2/+2
|
* don't hold a reference to `env` in the options objectAaron Patterson2015-06-131-13/+11
| | | | | I want to decouple Rails from the rack ENV as much as possible. We should try to keep as few references to the env as possible
* Add missing documentation for ActionDispatch::Request::Session [ci skip]Mehmet Emin İNAÇ2015-06-071-0/+33
|
* remove new line between doc and methodBruce Park2015-04-071-1/+0
|
* added docs for ActionDispatch::Request::Session#createBruce Park2015-04-071-1/+3
|
* Make ActionDispatch::Request::Session#fetch behave like Hash#fetchTrent Ogren2013-12-111-8/+8
| | | | | | Session#fetch was mutating the session when given a default argument and/or a block. Since Session duck-types as a Hash, it should behave like one in these cases.
* add the fetch method to sessionsDamien Mathieu2013-10-291-0/+12
|
* Integrate Action Pack with Rack 1.5Carlos Antonio da Silva2013-01-251-0/+4
| | | | | | All ActionPack and Railties tests are passing. Closes #8891. [Carlos Antonio da Silva + Santiago Pastorino]
* Merge pull request #7495 from steveklabnik/issue_7478Aaron Patterson2012-09-011-2/+5
|\ | | | | Properly reset the session on reset_session
| * Force reloading of the session after destroyAndreas Loupasakis2012-09-011-0/+3
| | | | | | | | | | | | | | Use load_for_write! to ensure a refresh of the session object. This way the new session_id and the empty data will be stored properly. E.g. in the case of the session cookie store this means that a new digest will be returned to the user.
| * Assign a new session_id to session options hashAndreas Loupasakis2012-09-011-2/+2
| |
* | Fix comment about Session.Steve Klabnik2012-08-311-1/+1
|/ | | | SessionHash isn't a thing, and tenses are wrong.
* Added ActionDispatch::Request::Session#keys and ↵Philip Arndt2012-05-231-0/+8
| | | | ActionDispatch::Request::Session#values
* need to dup the default options so that mutations will not impact usAaron Patterson2012-05-041-1/+1
|
* bread AD::Request::Session to it's own file, consolidate HASH OF DOOM lookupsAaron Patterson2012-05-031-0/+166