Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunny/devise-track_locale
Adds support to Devise for remembering a user's last locale
https://github.com/sunny/devise-track_locale
Last synced: 21 days ago
JSON representation
Adds support to Devise for remembering a user's last locale
- Host: GitHub
- URL: https://github.com/sunny/devise-track_locale
- Owner: sunny
- License: mit
- Created: 2015-07-05T16:37:47.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2021-04-29T07:41:03.000Z (over 3 years ago)
- Last Synced: 2024-04-26T00:42:27.475Z (9 months ago)
- Language: Ruby
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
devise-track_locale
===================Adds support to [Devise](http://github.com/plataformatec/devise) for
remembering a user's last locale.Installation
-----------Add the folling lines to your Gemfile:
```rb
# Remember the locale on user visits
gem "devise-track_locale"
```Usage
-----Add a `locale` attribute to your users:
```sh
$ rails g migration AddLocaleToUsers locale
$ rake db:migrate
```### Save the locale on every sign-in
In your model, add `:track_locale` as a devise module:
```rb
class User < ActiveRecord::Base
devise …, :track_locale
end
```### Save the locale only once
In your model, add `:track_default_locale` as a devise module:
```rb
class User < ActiveRecord::Base
devise …, :track_default_locale
end
```Copyright
---------By Sunny Ripert, under the MIT License. See LICENSE for details.