Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactoring code.

  • Loading branch information...
commit 4d36a4b76820aa79e86e4938836056e496a497a6 1 parent c772819
@carlosbrando carlosbrando authored
Showing with 1 addition and 9 deletions.
  1. +1 −9 Support/bin/list_columns.rb
View
10 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 }
Please sign in to comment.
Something went wrong with that request. Please try again.