I am so freaking awesome
(Dir.entries("#{RAILS_ROOT}/app/models") - [".","..",".svn"]).each do |model| has_many model.split(".").first.pluralize.to_sym, :foreign_key => "owner_id" end
I tried adding:
if model.classify.is_a?(ActiveRecord::Base) <<-EVAL class #{model.classify} belongs_to :owner end EVAL end
too, but Rails didn’t like that.

June 26th, 2008 at 5:33 am
Are you actually eval’ing the second one though? looks like you’re just getting a string for it.
June 28th, 2008 at 1:51 pm
D’oh! I should’ve called eval! Silly me. Thanks Sutto. I’ve abandoned that eval’ing path and just took the longer road by adding belongs_to :owner to all other models.