For some reason my previous mail didn't show up here.... grrrr i hate
it when i have to rewrite something that's long enough to take me 15
minutes to write again Anyway here it goes...
I tried what you said that worked for you so i could verify it and
also add some hints on the documentation of ActionController::Base but
didn't quite worked for me... Here's what i tried:
class GoalsController < ApplicationController
def short_goal
end
def long_goal
end
end
class FoulsController < ApplicationController
def penalty
if true
render :action => 'short_goal', :controller => 'goals'
end
end
end
and the views accordingly... The result when hitting fouls/penalty was
"Template missing. Missing template ./script/../config/../app/views/
FOULS/short_goal.rhtml"
After reading the source for ActionController::Base#render which calls
ActionController::Base#render_action when :action is passed i thought
that this result makes sense (at least to me). The source if you're
feeling lazy is:
def render_action(action_name, status = nil, with_layout = true)
#:nodoc:
template = default_template_name(action_name.to_s)
if with_layout && !template_exempt_from_layout?(template)
render_with_layout(:file => template, :status =>
status, :use_full_path => true, :layout => true)
else
render_without_layout(:file => template, :status =>
status, :use_full_path => true)
end
end
where "action_name" is the value of :action
So i tried the following:
class FoulsController < ApplicationController
def penalty
if true
render :action => '../goals/short_goal'
end
end
end
and worked. The thing is that i don't think this is a 'nice' way of
doing this - the smell of bugs is close
Also how can i call the action before rendering the view to set up the
variables. *** I know i should probably do a redirect instead all this
fuzz but curiosity is driving me at the moment ***
Waiting for your thoughts/comments/suggestions
-Nikos