--------------enig8BA334A3E1BAE200D6F13945 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Florian AÝÎann wrote: > To be complete here if the Exception: > > NameError: undefined local variable or method `role' for > #<Class:#<Person:0x2869aa0>> > I smell a Ruby bug / gotcha. Apparently, in metaclass scope, the surrounding scope just isn't visible.Try a workaround: person.roles.each do |role| if role.class.const_defined?('Functions') class << person self end.class_eval do include role.class.const_get('Functions') end end end unless person.nil? David Vallner PS: Statement modifiers after whole blocks? Ick. --------------enig8BA334A3E1BAE200D6F13945 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFIBOXy6MhrS8astoRAufoAJ4lgMrk/HCYYhnJL9j8x3UOMtRczwCdGLG0 7tV6V4mk/oWy6lsM8TeKOBY@JR -----END PGP SIGNATURE----- --------------enig8BA334A3E1BAE200D6F13945--