ominous 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,5 @@
1
1
  module Ominous
2
2
  class ApplicationController < ActionController::Base
3
3
 
4
- protected
5
- def check_ominous_warnings
6
- Warning.requests.each{|request| session_store << request}
7
- Warning.clear_requests
8
- end
9
- helper_method :check_ominous_warnings
10
-
11
- def session_store
12
- session[:ominous_warnings] ||= []
13
- end
14
-
15
4
  end
16
5
  end
@@ -21,7 +21,6 @@ module Ominous
21
21
  end
22
22
 
23
23
  def warnings_to_show?
24
- session_store
25
24
  session_store.values.include? :show
26
25
  end
27
26
 
@@ -34,6 +34,11 @@ module Ominous
34
34
  @requests = []
35
35
  end
36
36
 
37
+ # Called after each controller action.
38
+ def self.after_action_tasks
39
+ clear_requests # So that warnings called while processing one action are not carried over to the next where they may not be relevant
40
+ end
41
+
37
42
  private
38
43
  def method_missing(symbol, *args, &block)
39
44
  if acts_as_list_method?(symbol)
@@ -4,8 +4,12 @@ module Ominous
4
4
 
5
5
  initializer 'ominous.action_controller' do |app|
6
6
  ActiveSupport.on_load :action_controller do
7
+
7
8
  helper Ominous::ApplicationHelper
8
9
  helper Ominous::WarningsHelper
10
+
11
+ after_filter 'Ominous::Warning.after_action_tasks'
12
+
9
13
  end
10
14
  end
11
15
 
@@ -1,3 +1,3 @@
1
1
  module Ominous
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -8,7 +8,6 @@
8
8
  </head>
9
9
  <body>
10
10
 
11
- <%= ominous_warnings %>
12
11
  <%= yield %>
13
12
 
14
13
  </body>
@@ -1,3 +1,5 @@
1
+ <%#* helper method called here rather than in layout so that tests can be easily made with and without it acting %>
2
+ <%= ominous_warnings %>
1
3
  <p id="notice"><%= notice %></p>
2
4
 
3
5
  <p>