printing_press 0.1.0 → 0.2.0

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 CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -4,6 +4,7 @@ module PrintingPress
4
4
  def self.included(base)
5
5
  base.before_filter :set_printing_press_enabled_for_controller
6
6
  base.before_filter :setup_printing_press
7
+ base.after_filter :disable_printing_press
7
8
  base.send :extend, ClassMethods
8
9
  end
9
10
 
@@ -35,5 +36,13 @@ module PrintingPress
35
36
  end
36
37
  end
37
38
  end
39
+
40
+ def disable_printing_press
41
+ if ::PrintingPress.enabled_for_controller?
42
+ (self.class.try(:printing_press_models) || []).each do |model_name|
43
+ model_name.to_s.classify.constantize.try(:printing_press_off)
44
+ end
45
+ end
46
+ end
38
47
  end
39
48
  end
@@ -21,11 +21,13 @@ module PrintingPress
21
21
  def printing_press_off
22
22
  self.printing_press_enabled_for_model = false
23
23
  set_table_name reset_table_name
24
+ self.reset_column_information
24
25
  end
25
26
 
26
27
  def printing_press_on
27
28
  self.printing_press_enabled_for_model = true
28
29
  set_table_name self.published_table_name
30
+ self.reset_column_information
29
31
  end
30
32
 
31
33
  def drafts
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: printing_press
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Edmond Leung
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-19 00:00:00 -05:00
18
+ date: 2011-11-20 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency