Rails when does flash get set -
given following view code, if user not click button 'add wo attachment' - let's hit cancel instead. should flash[:workorder_id]
nil?
<div class="tab-pane" id="tabs-8"> <%= render 'filtered7' %> <% if @workorder.not_closed? %> <%= link_to 'add wo attachment', new_attachment_path, :class => 'btn btn-primary', :onclick => flash[:workorder_id] = @workorder.id %> <% end %> </div>
i believe gets set if don't click on button. , seems wrong me.
the onclick
attribute needs contain javascript executed client. if need set flash message, need make request, not doing.
this have effect of adding onclick="1"
html if @workorder.id
1, set flash
regardless of being clicked because of how you're forcing assignment.
if need set flash
conditionally, need make assignment in whatever handles new_attachment_path
, presumably new
method of attachmentscontroller
.
Comments
Post a Comment