Sha256: c804ad58b4c1d78f8032e5c2c669f254f752c5c826ed6d4170f43b7cd122c5d7
Contents?: true
Size: 1.23 KB
Versions: 8
Compression:
Stored size: 1.23 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
8 entries across 8 versions & 1 rubygems