Forum: Ruby on Rails reloading include-modules inside controller not working

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
36958dd94ca666a38483df282a5214d5?d=identicon&s=25 Peter Ertl (Guest)
on 2006-05-03 19:08
(Received via mailing list)
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 :-(

Any help appreciated :-)

Best Regards
Peter
9ab183bb240ffd3a3966d5a615b4bdeb?d=identicon&s=25 Philip Ross (Guest)
on 2006-05-03 19:08
(Received via mailing list)
Peter Ertl 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 :-(

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 Ross
http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby
This topic is locked and can not be replied to.