Default Render Action or Help Cleaning Up My View Folder

I have 30 actions which all render basically the same thing, basically
their name and a message either indicating success or failure:

    <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
    <title><%= "#{action_name} Update Result" %></title>
    <%= message %>

The trouble is, in order to do this I have a layout (partly shown
above) and then 30 blank files in my view directory named after the
actions they are associated with. I see no reason I have to create 30
blank view files. However, if I don't create the file then Rails will
not render the view because it will error out on not being able to
find an associated view file for this action.

I have considered adding a render line to the bottom of every action,
something like render :file => "layouts/mylayout" but it seems that's
more or less a brute force resolution like making 30 files is a brute
force solution.

Can I specify a default file to render for every action in a
controller? Someone has to know a more elegant, railsy solution to
this problem!

Thanks for your help,


You could use “after_filter :default_render” and then


def default_render

render => …


But probably there is a better sollution here:

The after_filter thing I tried before, and it causes a double-render
condition. I would then need to go through all the functions and do
render :none or something to that effect... Which just goes back to
the render at the end of each function problem.


Maybe you could try “before_filter” :slight_smile:

But nothing on solved your problem? :S