flagpole_sitta 0.9.4 → 0.9.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.
@@ -8,6 +8,29 @@ module FlagpoleSittaHelper
8
8
  model.try(:update_array_cache, key, :route_id => route_id)
9
9
  end
10
10
 
11
+ #In case an unsafe param gets passed.
12
+ #Don't want to save SQL injection attempts in the cache.
13
+ def clean_options options={}
14
+
15
+ result = Hash.new
16
+
17
+ options.each do |k,v|
18
+ #If it fails its not a string and it doesn't need to be
19
+ #sanitized anyway.
20
+ begin
21
+ clean_v = sanitize(v)
22
+ rescue
23
+ clean_v = v
24
+ end
25
+
26
+ result[k] = clean_v
27
+
28
+ end
29
+
30
+ result
31
+
32
+ end
33
+
11
34
  ##
12
35
  #AR - cache_sitta helper
13
36
  #NOTE This is not safe for .builder xml files.
@@ -64,6 +87,8 @@ module FlagpoleSittaHelper
64
87
  #and while it boils down to a call by id, they can still add up if you don't pay attention.
65
88
  def cache_sitta options={}, &block
66
89
 
90
+ options = clean_options(options)
91
+
67
92
  if options[:route_id].class.eql?(Array)
68
93
  main_route_id = options[:route_id][0]
69
94
  else
@@ -78,10 +103,6 @@ module FlagpoleSittaHelper
78
103
  main_model = options[:model]
79
104
  end
80
105
 
81
- elsif params[:model]
82
-
83
- main_model = params[:model]
84
-
85
106
  elsif options[:models_in_index]
86
107
 
87
108
  if options[:models_in_index].class.eql?(Array)
@@ -94,7 +94,7 @@ module FlagpoleSitta
94
94
  flag_key = array_cache_key_gen "Flag", options[:route_id]
95
95
  FlagpoleSitta::CommonFs.flagpole_cache_write(flag_key, flag)
96
96
 
97
- key
97
+ array_key
98
98
 
99
99
  end
100
100
 
@@ -1,3 +1,3 @@
1
1
  module FlagpoleSitta
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flagpole_sitta
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 4
10
- version: 0.9.4
9
+ - 5
10
+ version: 0.9.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Rove (Rover)
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-28 00:00:00 Z
18
+ date: 2012-09-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: dalli