[Rails] 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:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title><%= "#{action_name} Update Result" %></title>
</head>
<body>
<%= message %>
</body>
</html>
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,
Chris
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home