Hi,

I'm currently using Rails with a legacy database that uses it's own
naming conventions, one of them being that names are CamelCased.

To be consistent I tried to CamelCase also my HABTM association names
like:

   has_and_belongs_to_many :Roles

However due to the current AR code and the way Ruby resolves symbols
this fails.
Currently the has_and_belongs_to_many :foo ends-up in creating 2
methods foo (reader returning an Array) and foo= (writer). Then we have
some expressions like #{reflection.name}.clear, which are evaluated into
foo.clear, and Ruby resolves foo as being a method, and everything is
great.

If I do define has_and_belongs_to_many :Roles, the 2 methods (Roles and
Roles=) are created, and at some point Ruby tries to evaluate some code
like Roles.clear, which fails as Roles is considered as a constant and
no Roles constant is existing.

IMHO, this can be easily fixed by prepending a self to the
#{reflection.name} for example, and this is what is done in the patch
attached to ticket #4823.

Best Regards,
-- 
Frederick Ros aka Sleeper -- [EMAIL PROTECTED]

"All language designers are arrogant.  Goes with the territory..."
(By Larry Wall)

Attachment: pgpQIqvc3qXhi.pgp
Description: PGP signature

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to