Only display value of text_field if @search is present
I have an search form, for my Search model. My problem is that i only want
to display the value of the form if @search is present. I wrote this code:
<%= f.text_field :keyword, :value => @search.keyword if @search.present? %>
My problem is that when @search is not present the whole form is not
displayed! I only want that the value is not displayed in this case!
No comments:
Post a Comment