Sha256: d1c1f426ac33e7f4438e6ec1d2794469a7517bc8b2621a99693edd80c7171e60

Contents?: true

Size: 950 Bytes

Versions: 2

Compression:

Stored size: 950 Bytes

Contents

# * George Moschovitis  <gm@navel.gr>
# (c) 2004-2005 Navel, all rights reserved.
# $Id$

require 'nitro/render'
require 'nitro/scaffold'
require 'nitro/filters'

module N
	
# The Controller part in the MVC paradigm.
# A Controller encpsulates a set of actions.

class Controller 
	include Render
	include Scaffolding
	include Filtering		

	# Use the method_missing hook to compile the actions
	# for this controller.
	
	def method_missing(action, *args)
		if Rendering.compile_action(self.class, action, @base)
			# FIXME: temp hack!
			if :partial == Rendering.reload
				ret = send(action, *args)
				self.class.class_eval("remove_method :#{action}") # if $DBG
				return ret
			else
				send(action, *args)
			end
		else
			super
		end
	end

	class << self 
		alias __old_inherited inherited

		def inherited(subclass)
			subclass.class_eval %{
				DEF_FILE = caller.first.split(':').first
			}	
			__old_inherited(subclass)
		end
	end

end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.9.3 lib/nitro/controller.rb
nitro-0.9.5 lib/nitro/controller.rb