On 12/12/06, will
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> Ahoy,
>
> Was looking through AR::base.
>
> Could all this
>
>
> class ActiveRecordError < StandardError #:nodoc:
> end
> class SubclassNotFound < ActiveRecordError #:nodoc:
> end
> class AssociationTypeMismatch < ActiveRecordError #:nodoc:
> end
> ... (about 10 more)
>
> be replaced with
>
> ["SubclassNotFound","AssociationTypeMismatch",
etc...].each do
> ''error_name''
> class error_name < ActiveRecordError end
> end
>
>
Nope. Did you try writing a little script to see if it''s equivalent?
[ "A", "B", "C" ].each do |c|
class c < StandardError
end
end
... doesn''t work. Run it to see why.
But this does work;
[ "A", "B", "C" ].each do |c|
eval "class #{c} < StandardError
end"
end
... maybe
;)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---