Sha256: bbf240e1b1fefc8794aa9da313db644aa011c6c064f8e547f4dedd1cc6ed55bc
Contents?: true
Size: 1.21 KB
Versions: 7
Compression:
Stored size: 1.21 KB
Contents
# Upgrade notes ## Breaking changes with v0.7.0 There are two important changes needing your attention. Please read the following hints carefully! ### Polymorphic readers The gem accepts any type of classes as reader and it's not limited to `User` class anymore. So you can do stuff like: ```ruby Customer.have_not_read(message1) message1.mark_as_read! for: Customer.find(1) ``` If you are upgrading from v0.6.3 or older, you need to do the following after upgrading: ```shell rails g unread:polymorphic_reader_migration rake db:migrate ``` This will alter the `read_marks` table to replace `user` association to a polymorphic association named `reader`. Therefore, `user_id` is going to be renamed to `reader_id` and `reader_type` is going to be added. This change should not break your code unless you've worked with `ReadMark` model directly. ### Defining reader_scope The class method `acts_as_reader` doesn't take the option `:scope` anymore. If you have used it, please change this ... ```ruby class User < ActiveRecord::Base acts_as_reader scope: -> { where(is_admin: true) } end ``` ... to this ```ruby class User < ActiveRecord::Base acts_as_reader def self.reader_scope where(is_admin: true) end end ```
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
unread-0.14.0 | UPGRADE.md |
unread-0.13.1 | UPGRADE.md |
unread-0.13.0 | UPGRADE.md |
unread-0.12.0 | UPGRADE.md |
unread-0.11.0 | UPGRADE.md |
unread-0.10.1 | UPGRADE.md |
unread-0.10.0 | UPGRADE.md |