2005/11/24, Michael Koziarski <[EMAIL PROTECTED]>:
> SystemStackError isn't the user experience we're after though...
>
> Was there anything in your logs warning you that you'd overridden transaction?

Nope, and I have had the same kind of error with other base class
methods:  quote, transaction.

What we need is a check in has_many, has_one, belongs_to and
has_and_belongs_to_many that checks whether the method already exists
in the current context, and bail out if it does.

Something like this:
def has_many(...)
  ...
  check_association_method_not_already_exist(association_name)
  ...
end

def check_association_method_not_already_exist(association_name)
  raise InvalidAssociationName, "Association name #{association_name}
already exists - you can't use it" if
self.class.methods.include?(association_name)
end

Untested, but should be about right, no ?  Ok ok, I do volunteer to
write the patch :)  Unless someone's already on it ?

Bye !
--
François Beausoleil
http://blog.teksol.info/
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to