<p>How do I find the name of the namespace or module 'Foo' in the filter below?</p>

<pre><code>class ApplicationController &lt; ActionController::Base
  def get_module_name
    @module_name = ???
  end
end


class Foo::BarController &lt; ApplicationController
  before_filter :get_module_name
end
</code></pre>

This should do it:
```
```
def get_module_name
    @module_name = self.class.to_s.split("::").first
  end
```
```