KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
When I render a partial which does not exists, I get an Exception. I'd like to check if a partial exists before rendering it and in case it doesn't exist, I'll render something else. I did the following code in my .erb file, but I think there should be a better way to do this: <% begin %> <%= render :partial => "#{dynamic_partial}" %> <% rescue ActionView::MissingTemplate %> Can't show this data! <% end %>
Tags (comma-separated)
Save Edits
Cancel