Reloading include-modules inside controller not working


#1

Hi guys,

I would expect an ActionController-derived class to reload completely
in
development mode.

class FooController < ApplicationController
include FancyStuffSupport

def index
# bla
end

more actions here

end

However, the ‘FancyStuffSupport’ is not reloaded, only the
‘FooController’
itself. Can this behaviour be changed? I feel back in Java when I have
to
restart the server for every tiny change :frowning:

Any help appreciated :slight_smile:

Best Regards
Peter


#2

Peter E. wrote:

I would expect an ActionController-derived class to reload completely in
development mode.

class FooController < ApplicationController
include FancyStuffSupport
end

However, the ‘FancyStuffSupport’ is not reloaded, only the ‘FooController’
itself. Can this behaviour be changed? I feel back in Java when I have to
restart the server for every tiny change :frowning:

Add a require_dependency ‘fancy_stuff_support’ to your controller file.
This will cause a reload on each request. See
http://wiki.rubyonrails.com/rails/pages/RequireDependency for more
details.


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby