Wednesday, 15 April 2015

drop down menu - view file for Ruby on Rails with dropdown box inexplicably not working -



drop down menu - view file for Ruby on Rails with dropdown box inexplicably not working -

i've created 2 models, 1 bar, 1 special. i've created dropdown box in new special view file want display bars. here code.

<%= form_for(@special) |f| %> <% if @special.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@special.errors.count, "error") %> prohibited special beingness saved:</h2> <ul> <% @special.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <div class="field"> <%= f.label :special %><br /> <%= f.text_field :special %> </div> <div class="field"> <%= f.collection_select(:special, :bar_id, bar.all, :id, :name, :prompt => "select bar" %> </div> <div class="actions"> <%= f.submit %> </div> <% end %>

sorry poor formatting above. when run code this:

showing d:/devprojects/tapadeal/app/views/specials/_form.html.erb line #24 raised:

d:/devprojects/tapadeal/app/views/specials/_form.html.erb:24: syntax error, unexpected keyword_end, expecting ')' '); end ^ d:/devprojects/tapadeal/app/views/specials/_form.html.erb:26: syntax error, unexpected keyword_ensure, expecting ')' d:/devprojects/tapadeal/app/views/specials/_form.html.erb:28: syntax error, unexpected keyword_end, expecting ')' extracted source (around line #24):

extracted source (around line #24):

21: div class="actions"

22: <%= f.submit %>

23: /div

24: <% end %>

any ideas or suggestions appreciated.

try closing parentheses:

<%= f.collection_select(:special, :bar_id, bar.all, :id, :name, :prompt => "select bar") %>

ruby-on-rails drop-down-menu

No comments:

Post a Comment