Commit 8674ccd1a2998e3f16e29d8fa0bfce558ed4d7bc
1 parent
a405a4a6
Exists in
master
and in
29 other branches
tolerance-time: Proc to fix (undefined method 'environment' for nil:nilClass)
Showing
1 changed file
with
2 additions
and
3 deletions
Show diff stats
plugins/tolerance_time/lib/tolerance_time_plugin.rb
... | ... | @@ -28,7 +28,7 @@ class ToleranceTimePlugin < Noosfero::Plugin |
28 | 28 | end |
29 | 29 | |
30 | 30 | def cms_controller_filters |
31 | - return if !context.environment.plugin_enabled?(ToleranceTimePlugin) | |
31 | + p = Proc.new { |context| return if !context.environment.plugin_enabled?(ToleranceTimePlugin) } | |
32 | 32 | block = lambda do |
33 | 33 | content = Article.find(params[:id]) |
34 | 34 | if ToleranceTimePlugin.expired?(content) |
... | ... | @@ -36,7 +36,6 @@ class ToleranceTimePlugin < Noosfero::Plugin |
36 | 36 | redirect_to content.url |
37 | 37 | end |
38 | 38 | end |
39 | - | |
40 | 39 | { :type => 'before_filter', |
41 | 40 | :method_name => 'expired_content', |
42 | 41 | :options => {:only => 'edit'}, |
... | ... | @@ -44,7 +43,7 @@ class ToleranceTimePlugin < Noosfero::Plugin |
44 | 43 | end |
45 | 44 | |
46 | 45 | def content_viewer_controller_filters |
47 | - return if !context.environment.plugin_enabled?(ToleranceTimePlugin) | |
46 | + p = Proc.new { |context| return if !context.environment.plugin_enabled?(ToleranceTimePlugin) } | |
48 | 47 | block = lambda do |
49 | 48 | content = Comment.find(params[:id]) |
50 | 49 | if ToleranceTimePlugin.expired?(content) | ... | ... |