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!
UPDATE UPDATE:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I wrote an little helper:
def value(link)
if @search.present?
value: @search.link
end
end
And in my form:
<%= f.text_field :keyword, value(keyword) %>
But why do i get this error:
s_helper.rb:4: syntax error, unexpected ':', expecting keyword_end value: @search.link