Right now I have something like this:
<%= render :partial => "widgets/type1.html.erb", :locals => {:widget => @wall} %>
I have 50 different types
widgets/type1.html.erb
widgets/type2.html.erb
widgets/type3.html.erb
widgets/type4.html.erb
....
In the widget object, there is a widget.type which has the type2 etc… Is there a way I can make the partial dynamic to avoid all the if statements?
Thanks
Since you can tell rails to render :partial=>string, you can do string replacement inside that string. So, if @widget is the variable name: