source not reloading on development env

First thing that comes to mind is that your application isn’t completely restarting. Do you have more than one back-end server? (mongrel)

Check to see that they’ve all restarted

I've had this issue too - I believe there is a bug filed for it already. AFAIR the relations don't get properly reloaded and the you get methods missing of course - pretty annoying stuff.

I ran into this today. Short version: don't require things if they'll
be autoloaded.

Long version: If you just write Customer, const_missing gets hit, which goes off to
the Dependencies stuff. This marks customer as a thing that was
autoloaded, and when the application is reset it know to unload the
Customer model.

if you require 'customer' none of this happens, and so customer is not
put on the list of autoloaded things, and it not reloaded.

Where it gets really bad is if for example customer has_one :order. Customer is not reloaded, and so hangs on to the 'old' version of
order. This old version was cleared out as part of the reset, which
leads to mysterious method_missing errors

Fred

thanks frederick. so you reckon that i dont require something which is being autoloaded... the funny thing is that i am not using require for my classes .. they are all autoloaded ...

Well I'd double check and scan through everything. If you've got
models in plugins that can also be problematic (remove the plugin's
lib path to Dependencies.load_once_paths if that happens). I forget
exactly how but you can also get the Dependencies system to log what
it's up to.

Fred

I'd change that to

class User < ActiveRecord::Base    include CustomValidationsHelper

   validates_confirmation_of :email end

Including the module at the top level probably does odd things to the autoloading stuff.

Fred

include CustomValidationsHelper

class User < ActiveRecord::Base :validates_confirmation_of :email

That leading colon is a typo?

end

That top-level include is strange, you probably want to mixin the module into User. But in any case a model that has an attribute to confirm needs a virtual attribute_confirmation accessor to be seteable and validable:

   class User < AR::Base      attr_accessor :email_confirmation      validates_confirmation_of :email    end

Unless email_confirmation= is defined by some code you don't show it does not exist and Ruby rightly complains.

-- fxn

Oh yes you are right.

The Agile uses those explicit attr_accessors, but I see there's a patch to make the docs clear about this:

   http://dev.rubyonrails.org/ticket/8815

-- fxn