ruby - Drop down form not saving to database -


my haml code below supposed show drop down form 3 different options (qa, staging, production). if contact_title has no value or equal nil set default value of qa in sqlite db. if set should show default set value in ui. current code not work. elegant way it?

%tr           %td{:style => 'width: 30%'}             qa or production           %td{:style => 'width: 70%'}             %label{:type => 'text', :name => 'contact_title', :value => "#{@report.contact_title}"}             .controls               %select{:name => "contact_title"}                 %option{:selected => "selected" } qa                 %option{:select => "select" } staging                 %option{:select => "select" } production                 - if @report.contact_title.nil? or @report.contact_title == 0                   %option{:selected => "selected" } qa                   %option staging                   %option production                 - if @report.contact_title == 'staging'                   %option{:selected => "selected" } staging                   %option qa                   %option production                 - if @report.contact_title == 'production'                   %option{:selected => "selected" } production                   %option qa                   %option staging 


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -