ominous 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/ominous/application_controller.rb +0 -11
- data/app/helpers/ominous/application_helper.rb +0 -1
- data/app/models/ominous/warning.rb +5 -0
- data/lib/ominous/engine.rb +4 -0
- data/lib/ominous/version.rb +1 -1
- data/test/dummy/app/views/layouts/application.html.erb +0 -1
- data/test/dummy/app/views/things/show.html.erb +2 -0
- data/test/dummy/log/test.log +6103 -0
- data/test/dummy/test/functional/things_controller_test.rb +6 -0
- metadata +2 -4
- data/test/dummy/test/fixtures/things.yml +0 -9
@@ -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
|
@@ -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)
|
data/lib/ominous/engine.rb
CHANGED
@@ -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
|
|
data/lib/ominous/version.rb
CHANGED