ruby on rails 3 - show or hide object based on completed field -


i'm pretty new ror programming. remember reading on tutorial (forgot which) it's possible show or hide field based on if filled out or not.

something like

if @vendor.state.present   <%= @vendor.state %> else   # hide field (don't show user) end 

is possible, , have right terms?

i'm not sure understand want but:

<%= "<div>#{@vendor.state}</div>" unless @vendor.state.blank? %> 

this output @vendor.state variable wrapped in div tag unless nil or empty string.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -