Skip to content

Instantly share code, notes, and snippets.

@jrom
Created June 16, 2011 09:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrom/1028970 to your computer and use it in GitHub Desktop.
Save jrom/1028970 to your computer and use it in GitHub Desktop.
Hack to create a new skinny model from an existing one
# By James Urquhart (jamesu)
class ActiveRecord::Base
def self.thin_model
table = table_name
@@thin_model ||= Class.new(superclass).tap do |anon|
anon.class_eval { set_table_name table }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment