Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 10/30/08

Interesting Things

  • Removing class definitions with Object.send(:remove_const, :Foo)

Sometimes it is necessary to reload or replace a stub/test class during testing (apparently rspec is particularly susceptible to this). This can be achieved using Object.send(:remove_const, :Foo) where Foo is the camel-cased name of the class. If your class is defined within a module, it may be necessary to use Module.send(:remove_const, :Foo)

Ask for help

  • versus

As a point of curiosity, does anybody know when has_many relationship reloading moved from (or to?) to The reload syntax seems preferable for readability; will continue to work in the future?

  1. Pat Nakajima says:

    Calling `#reload` is just an instance method on ActiveRecord::Base to reload whatever object you call it on from the database. Since the `bar` in `` is just an ActiveRecord, you can reload it.

    The `` syntax is an association proxy specific way of reloading your association.

    I think.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *