diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/4_1_release_notes.md | 3 | ||||
-rw-r--r-- | guides/source/action_controller_overview.md | 20 | ||||
-rw-r--r-- | guides/source/asset_pipeline.md | 15 |
3 files changed, 15 insertions, 23 deletions
diff --git a/guides/source/4_1_release_notes.md b/guides/source/4_1_release_notes.md index 477268f4bc..7399bfb5de 100644 --- a/guides/source/4_1_release_notes.md +++ b/guides/source/4_1_release_notes.md @@ -567,6 +567,9 @@ for detailed changes. * Removed deprecated `assert_present` and `assert_blank` methods, use `assert object.blank?` and `assert object.present?` instead. +* Remove deprecated `#filter` method for filter objects, use the corresponding + method instead (e.g. `#before` for a before filter). + ### Deprecations * Deprecated `Numeric#{ago,until,since,from_now}`, the user is expected to diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 0234120b45..9eaf03dd82 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -384,20 +384,14 @@ YourApp::Application.config.session_store :cookie_store, key: '_your_app_session You can pass `:serializer` key to specify serializer for serializing session: ```ruby -YourApp::Application.config.session_store :cookie_store, key: '_your_app_session', serializer: :json_serializer +YourApp::Application.config.session_store :cookie_store, key: '_your_app_session', serializer: :json ``` -Default serializer is `:marshal_serializer`. When Symbol or String is passed it -will look for appropriate class in `ActionDispatch::Session` namespace, so -passing `:my_custom_serializer` would load -`ActionDispatch::Session::MyCustomSerializer`. +The default serializer for new application is `:json`. For compatibility with +old applications `:marshal` is used when `serializer` option is not specified. -```ruby -YourApp::Application.config.session_store :cookie_store, key: '_your_app_session', serializer: :my_custom_serializer -``` - -It is also possible to pass serializer object with defined `load` and `dump` -public methods: +It is also possible to pass a custom serializer class with `load` and `dump` +public methods defined: ```ruby YourApp::Application.config.session_store :cookie_store, key: '_your_app_session', serializer: MyCustomSerializer @@ -709,7 +703,7 @@ class ApplicationController < ActionController::Base end class LoginFilter - def self.filter(controller) + def self.before(controller) unless controller.send(:logged_in?) controller.flash[:error] = "You must be logged in to access this section" controller.redirect_to controller.new_login_url @@ -718,7 +712,7 @@ class LoginFilter end ``` -Again, this is not an ideal example for this filter, because it's not run in the scope of the controller but gets the controller passed as an argument. The filter class has a class method `filter` which gets run before or after the action, depending on if it's a before or after filter. Classes used as around filters can also use the same `filter` method, which will get run in the same way. The method must `yield` to execute the action. Alternatively, it can have both a `before` and an `after` method that are run before and after the action. +Again, this is not an ideal example for this filter, because it's not run in the scope of the controller but gets the controller passed as an argument. The filter class must implement a method with the same name as the filter, so for the `before_action` filter the class must implement a `before` method, and so on. The `around` method must `yield` to execute the action. Request Forgery Protection -------------------------- diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index 40e0770177..0422dda0d8 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -496,16 +496,11 @@ In this example, `require_self` is used. This puts the CSS contained within the file (if any) at the precise location of the `require_self` call. If `require_self` is called more than once, only the last call is respected. -NOTE. If you want to use multiple Sass files, you should generally use the [Sass -`@import` -rule](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#import) instead -of these Sprockets directives. Using Sprockets directives all Sass files exist -within their own scope, making variables or mixins only available within the -document they were defined in. You can do file globbing as well using -`@import "*"`, and `@import "**/*"` to add the whole tree equivalent to how -`require_tree` works. Check the [sass-rails -documentation](https://github.com/rails/sass-rails#features) for more info and -important caveats. +NOTE. If you want to use multiple Sass files, you should generally use the [Sass `@import` rule](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#import) +instead of these Sprockets directives. Using Sprockets directives all Sass files exist within +their own scope, making variables or mixins only available within the document they were defined in. +You can do file globbing as well using `@import "*"`, and `@import "**/*"` to add the whole tree +equivalent to how `require_tree` works. Check the [sass-rails documentation](https://github.com/rails/sass-rails#features) for more info and important caveats. You can have as many manifest files as you need. For example, the `admin.css` and `admin.js` manifest could contain the JS and CSS files that are used for the |