unread 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ 0.0.5 - 2011/09/09
2
+
3
+ * Fixed class loading issue in development environment
4
+
1
5
  0.0.4 - 2011/08/31
2
6
 
3
7
  * Ignore multiple calls of acts_as_*
@@ -5,9 +5,6 @@ module Unread
5
5
 
6
6
  module ActsAsReadable
7
7
  def acts_as_reader
8
- # Ignore multiple calls
9
- return if ReadMark.reader_class
10
-
11
8
  ReadMark.reader_class = self
12
9
 
13
10
  has_many :read_marks, :dependent => :delete_all
@@ -20,22 +17,19 @@ module Unread
20
17
  end
21
18
 
22
19
  def acts_as_readable(options={})
23
- # Ignore multiple calls
24
- return if self.included_modules.include?(InstanceMethods)
25
-
26
- options.reverse_merge!({ :on => :updated_at })
27
20
  if respond_to?(:class_attribute)
28
21
  class_attribute :readable_options
29
22
  else
30
23
  class_inheritable_accessor :readable_options
31
24
  end
25
+
26
+ options.reverse_merge!({ :on => :updated_at })
32
27
  self.readable_options = options
33
28
 
34
- self.has_many :read_marks, :as => :readable, :dependent => :delete_all
29
+ has_many :read_marks, :as => :readable, :dependent => :delete_all
35
30
 
36
- classes = ReadMark.readable_classes || []
37
- classes << self
38
- ReadMark.readable_classes = classes
31
+ ReadMark.readable_classes ||= []
32
+ ReadMark.readable_classes << self unless ReadMark.readable_classes.map(&:name).include?(self.name)
39
33
 
40
34
  scope_method = ActiveRecord::VERSION::MAJOR < 3 ? :named_scope : :scope
41
35
 
@@ -1,3 +1,3 @@
1
1
  module Unread
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -19,6 +19,14 @@ class UnreadTest < ActiveSupport::TestCase
19
19
  def test_schema_has_loaded_correctly
20
20
  assert_equal [@email1, @email2], Email.all
21
21
  end
22
+
23
+ def test_readable_classes
24
+ assert_equal [ Email ], ReadMark.readable_classes
25
+ end
26
+
27
+ def test_reader_class
28
+ assert_equal User, ReadMark.reader_class
29
+ end
22
30
 
23
31
  def test_scope
24
32
  assert_equal [@email1, @email2], Email.unread_by(@user)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unread
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Georg Ledermann
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-31 00:00:00 Z
18
+ date: 2011-09-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activerecord
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  requirements: []
151
151
 
152
152
  rubyforge_project: unread
153
- rubygems_version: 1.8.10
153
+ rubygems_version: 1.8.6
154
154
  signing_key:
155
155
  specification_version: 3
156
156
  summary: Manages read/unread status of ActiveRecord objects