Skip to content

Instantly share code, notes, and snippets.

@mattwynne
Created February 9, 2012 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattwynne/1782956 to your computer and use it in GitHub Desktop.
Save mattwynne/1782956 to your computer and use it in GitHub Desktop.
Find any ActiveRecords being passed into your views.
class ApplicationController < ActionController::Base
require 'test/unit/assertions'
include Test::Unit::Assertions
after_filter do
instance_variables.each do |variable|
assert !instance_variable_get(variable).is_a?(ActiveRecord::Base), "#{variable} is an ActiveRecord"
end
end
#...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment