Skip to content

Instantly share code, notes, and snippets.

@Dishwasha
Created August 13, 2009 19:55
Show Gist options
  • Save Dishwasha/167421 to your computer and use it in GitHub Desktop.
Save Dishwasha/167421 to your computer and use it in GitHub Desktop.
class AlertPresenter < CachingPresenter
presents :alert, :accepts => [:action, :current_user]
attr_reader :action
def acknowledged_by_user?
if attempt = @alert.alert_attempts.find_by_user_id(@current_user)
attempt.acknowledged?
end
end
def ask_for_acknowledgement?
@alert.acknowledge? && !@alert.new_record? && !acknowledged_by_user?
end
end
ActionView::TemplateError in '/alerts/index.html.erb should show the severity'
undefined method `acknowledged_by_user?' for #<Alert:0x7fdb6e1afcd8>
On line #43 of app/views/alerts/index.html.erb
40: <%=simple_format h(alert.message) %></dd>
41: </div>
42:
43: <% unless alert.acknowledged_by_user? %>
44: <%= acknowledge_alert_button(alert) %>
45: <% end %>
46: </div>
app/views/alerts/index.html.erb:43
app/views/alerts/index.html.erb:5
app/views/alerts/index.html.erb:4:in `each'
app/views/alerts/index.html.erb:4
/usr/lib/ruby/gems/1.8/gems/rspec-rails-1.2.7.1/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
/usr/lib/ruby/gems/1.8/gems/rspec-rails-1.2.7.1/lib/spec/rails/example/view_example_group.rb:170:in `__send__'
/usr/lib/ruby/gems/1.8/gems/rspec-rails-1.2.7.1/lib/spec/rails/example/view_example_group.rb:170:in `render'
/spec/views/alerts/index.html.erb_spec.rb:19:in `render'
/spec/views/alerts/index.html.erb_spec.rb:15
rspec (1.2.8) lib/spec/example/example_methods.rb:70:in `instance_eval'
rspec (1.2.8) lib/spec/example/example_methods.rb:70:in `eval_each_fail_fast'
rspec (1.2.8) lib/spec/example/example_methods.rb:70:in `each'
rspec (1.2.8) lib/spec/example/example_methods.rb:70:in `eval_each_fail_fast'
rspec (1.2.8) lib/spec/example/example_group_hierarchy.rb:17:in `run_before_each'
rspec (1.2.8) lib/spec/example/example_methods.rb:103:in `run_before_each'
rspec (1.2.8) lib/spec/example/example_methods.rb:124:in `before_each_example'
rspec (1.2.8) lib/spec/example/example_methods.rb:39:in `execute'
/usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
rspec (1.2.8) lib/spec/example/example_methods.rb:37:in `execute'
rspec (1.2.8) lib/spec/example/example_group_methods.rb:207:in `run_examples'
rspec (1.2.8) lib/spec/example/example_group_methods.rb:205:in `each'
rspec (1.2.8) lib/spec/example/example_group_methods.rb:205:in `run_examples'
rspec (1.2.8) lib/spec/example/example_group_methods.rb:103:in `run'
rspec (1.2.8) lib/spec/runner/example_group_runner.rb:23:in `run'
rspec (1.2.8) lib/spec/runner/example_group_runner.rb:22:in `each'
rspec (1.2.8) lib/spec/runner/example_group_runner.rb:22:in `run'
rspec (1.2.8) lib/spec/runner/options.rb:127:in `run_examples'
rspec (1.2.8) lib/spec/runner/command_line.rb:9:in `run'
rspec (1.2.8) bin/spec:4
The alert model does not have a method called acknowledged_by_user?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment