I had the same problem and fixed it.
The problem is the way the system trys to change the path of the
template root so it can include it''s own templates and partials.
My fix is quick and dirty because I need it working now and elegance
is not on my highest priority list... but here is my fix.
class RoutingNavigatorController < ActionController::Base
routing_navigator :off if respond_to? :routing_navigator
# self.view_paths << File.join(RAILS_ROOT, ''vendor/plugins/
routing_navigator/views'')
#for access by the model
def self.view_path
File.join(RAILS_ROOT,
''vendor/plugins/routing_navigator/views'')
end
def index
#manually added
self.view_paths << File.join(RAILS_ROOT, ''vendor/plugins/
routing_navigator/views'')
@filter = YAML.load(params[:filter].to_s).symbolize_keys rescue
nil
end
def recognize_url
render :text
=> ::ActionController::Routing::Routes.recognize_path(params[:path]).inspect,
:layout
=> false
end
def generate_route
render :text
=>
::ActionController::Routing::Routes.generate(YAML.load(params[:options]).symbolize_keys).inspect,
:layout
=> false
end
end
#in routing_navigator.rb ~line 32
ActionController::Base.class_eval do
class_inheritable_reader :routing_navigator_options
after_filter :append_routing_navigator if RAILS_ENV ==
''development''
# Set what actions the routing navigator after filter is
def self.routing_navigator(options = {})
options = { options => true } if [:off, :on].include?(options)
write_inheritable_hash :routing_navigator_options, options
end
protected
def append_routing_navigator
options = routing_navigator_options || {:off => true}
# yuck!
return if request.xhr? || options[:off] || (!
params[:format].blank? && params[:format] != ''html'')
|| (response.body
=~ /<\/body/).nil? ||
(options[:only] && !
[options[:only]].flatten.collect(&:to_s).include?(action_name)) ||
(options[:except] &&
[options[:except]].flatten.collect(&:to_s).include?(action_name))
# yuck!
# old_template_root = @template.view_paths
begin
@template.view_paths << RoutingNavigatorController.view_path
response.body.gsub!(/<\/body/, @template.render(:partial =>
''routing_navigator/navigator'') +
''</body'')
ensure
@template.view_paths = old_template_root
end
end
end
Try that and it should work.
On Mar 26, 3:01 pm, James Byrne
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Has anyone got this working under Rails 2.0.2? I get
>
> undefined method `template_root='' for
RoutingNavigatorController:Class
>
> When I try and use it. I discovered a previous post on the subject but
> the advice given there (substitute view_paths for template_root) does
> not work for me.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---