Permalink
Browse files

Refactoring code.

  • Loading branch information...
1 parent c772819 commit 4d36a4b76820aa79e86e4938836056e496a497a6 @carlosbrando carlosbrando committed Jun 16, 2010
Showing with 1 addition and 9 deletions.
  1. +1 −9 Support/bin/list_columns.rb
@@ -88,15 +88,7 @@ def cache_attributes
require "#{TextMate.project_directory}/config/environment"
Dir.glob(File.join(Rails.root, "app/models/**/*.rb")) do |file|
- begin
- klass = file.sub(Rails.root.to_s + '/app/models/', '').sub('.rb', '').camelize.constantize
- rescue LoadError
- begin
- klass = File.basename(file, '.*').camelize.constantize
- rescue LoadError
- klass = nil
- end
- end
+ klass = File.basename(file, '.*').camelize.constantize rescue nil
if klass and klass.class.is_a?(Class) and klass.ancestors.include?(ActiveRecord::Base)
_cache[klass.name.underscore] = { :associations => klass.reflections.stringify_keys.keys, :columns => klass.column_names }

0 comments on commit 4d36a4b

Please sign in to comment.