publishus 0.0.2 → 0.0.3
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.
- data/VERSION +1 -1
- data/lib/publishus.rb +16 -5
- data/publishus.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.3
|
data/lib/publishus.rb
CHANGED
|
@@ -17,7 +17,6 @@ module Publishus
|
|
|
17
17
|
module ClassMethods
|
|
18
18
|
|
|
19
19
|
def publishable
|
|
20
|
-
|
|
21
20
|
versioned
|
|
22
21
|
named_scope :published, :conditions => "#{name.tableize}.published_at is not null and (#{name.tableize}.deleted_at < #{name.tableize}.published_at or #{name.tableize}.deleted_at is null)" do
|
|
23
22
|
def live
|
|
@@ -26,7 +25,7 @@ module Publishus
|
|
|
26
25
|
end
|
|
27
26
|
end
|
|
28
27
|
end
|
|
29
|
-
|
|
28
|
+
before_destroy :choose_fait
|
|
30
29
|
include InstanceMethods
|
|
31
30
|
end
|
|
32
31
|
|
|
@@ -44,10 +43,13 @@ module Publishus
|
|
|
44
43
|
end
|
|
45
44
|
end
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
attr_accessor :proper_destroy
|
|
47
|
+
|
|
48
|
+
def real_destroy
|
|
49
|
+
@proper_destroy = true
|
|
50
|
+
destroy
|
|
49
51
|
end
|
|
50
|
-
|
|
52
|
+
|
|
51
53
|
def publish!(time=nil)
|
|
52
54
|
self.update_attribute(:published_at, time||Time.now)
|
|
53
55
|
end
|
|
@@ -60,6 +62,15 @@ module Publishus
|
|
|
60
62
|
def published?
|
|
61
63
|
!self.published_at.nil?
|
|
62
64
|
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def choose_fait
|
|
69
|
+
unless @proper_destroy
|
|
70
|
+
self.update_attribute(:deleted_at, Time.now)
|
|
71
|
+
false
|
|
72
|
+
end
|
|
73
|
+
end
|
|
63
74
|
end
|
|
64
75
|
|
|
65
76
|
end
|
data/publishus.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{publishus}
|
|
8
|
-
s.version = "0.0.
|
|
8
|
+
s.version = "0.0.3"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["lostboy"]
|
|
12
|
-
s.date = %q{2010-05-
|
|
12
|
+
s.date = %q{2010-05-22}
|
|
13
13
|
s.description = %q{Publishus allows active record models and associations to be published and exist both in a 'current' and 'live' state}
|
|
14
14
|
s.email = %q{paul.crabtree@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: publishus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 25
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.0.3
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- lostboy
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-05-
|
|
18
|
+
date: 2010-05-22 00:00:00 +01:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|