Should local_assigns.has_key be widely used? partially considered a code smell?
I have a Rails piece that has several checks like this:
<%= if local_assigns.has_key?(:show_blabla) && show_blabla == false %>
blabla
<% end %>
I think this kind hides the real list of parameters that are used so partial, and hey local_assigns
doesn't even apply to the documentation.
What are your thoughts?
+1
a source to share
4 answers
See "Passing Local Variables to Subpatterns" in
Class: ActionView :: Base for documentation on local_assigns
.
+2
a source to share