From: Francois Beausoleil Date: 2007-02-03T01:55:34+09:00 Subject: Calling a class method from an extended object Hi all ! I'm on Rails, and I have a general Ruby question. Here's a part of my code: class MockControllerBase; end module AuthenticatedSystem def self.included(base) base.send :include, AuthenticatedSystem::InstanceMethods base.send :extend, AuthenticatedSystem::ClassMethods end module ClassMethods def required_permissions(options={}) logger.debug{"AuthenticatedSystem#required_permissions(#{options.inspect})"} end end module InstanceMethods def authorized? false end endend class AuthenticatedSystemAuthorizationTest < Test::Unit::TestCase def setup class << @controller = MockControllerBase.new include AuthenticatedSystem end end def test_wide_open_lets_any_action_go_through @controller.class.required_permissions true @params[:action] = "create" assert @controller.authorized? endend I cannot seem to call #required_permissions after it was included.How should I access it ? Both@controller.class.required_permissions true and@controller.required_permissions true raise a NoMethodError, with a different object. Should I refactor, or do things differently ? Thanks !-- Franå·½ois Beausoleilhttp://blog.teksol.info/http://piston.rubyforge.org/