def controller_for_slice(slice_module = nil, options = {})
options, slice_module = slice_module.merge(options), nil if slice_module.is_a?(Hash)
slice_module ||= self.name.split('::').first
options[:templates_for] = :view unless options.key?(:templates_for)
if slice_mod = Merb::Slices[slice_module.to_s]
unless self.kind_of?(Merb::Slices::ControllerMixin::MixinMethods)
self.send(:extend, Merb::Slices::ControllerMixin::MixinMethods)
end
self.class_inheritable_accessor :slice, :instance_writer => false
self.slice = slice_mod
if options[:templates_for]
self._template_root = join_template_path(slice_mod.dir_for(options[:templates_for]), options[:path])
self._template_roots = []
self._template_roots << [join_template_path(Merb.dir_for(options[:templates_for]), options[:path]), :_template_location] if Merb.dir_for(options[:templates_for])
self._template_roots << [self._template_root, :_slice_template_location]
self._template_roots << [join_template_path(slice_mod.app_dir_for(options[:templates_for]), options[:path]), :_slice_template_location]
self._template_roots += Array(options[:template_roots]) if options[:template_roots]
end
layout_for_slice(options[:layout])
end
end