How do you find the namespace/module name programatically in Ruby on Rails?

Posted by Steropes on Stack Overflow See other posts from Stack Overflow or by Steropes
Published on 2008-09-25T13:34:38Z Indexed on 2010/05/06 8:18 UTC
Read the original article Hit count: 195

Filed under:
|
|

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

class ApplicationController < ActionController::Base
  def get_module_name
    @module_name = ???
  end
end


class Foo::BarController < ApplicationController
  before_filter :get_module_name
end

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails