lib/simple_navigation/renderer/base.rb in simple-navigation-1.2.1 vs lib/simple_navigation/renderer/base.rb in simple-navigation-1.2.2

- old
+ new

@@ -8,23 +8,37 @@ # optionally with the current_sub_navigation (if the sub_navigation will be nested). class Base include ActionView::Helpers::UrlHelper include ActionView::Helpers::TagHelper - attr_reader :current_navigation, :current_sub_navigation + attr_reader :current_navigation, :current_sub_navigation, :controller + + class << self + + # Delegates method calls to the controller. + def controller_method(*methods) + methods.each do |method| + delegate method, :to => :controller + end + end + + end + + controller_method :form_authenticity_token, :protect_against_forgery?, :request_forgery_protection_token def initialize(current_navigation, current_sub_navigation=nil) #:nodoc: @current_navigation = current_navigation @current_sub_navigation = current_sub_navigation + @controller = SimpleNavigation.controller end - + # Renders the specified ItemContainer to HTML. # # If <tt>include_sub_navigation</tt> is set to true, the renderer should nest the sub_navigation for the active navigation # inside that navigation item. def render(item_container, include_sub_navigation=false) raise 'subclass responsibility' end - + end end end \ No newline at end of file