开发者

hash enumeration and using outside arguments

开发者 https://www.devze.com 2023-02-11 22:45 出处:网络
I have a form builder and the normal |f| variable.In the middle I\'d like to iterate over some hash and get a list of keys by which to build the form.How can I incorporate \"f\" as an argument to the

I have a form builder and the normal |f| variable. In the middle I'd like to iterate over some hash and get a list of keys by which to build the form. How can I incorporate "f" as an argument to the enumerator.

<%= form_for ..... do |f| %>
<% available_types.each do |k,v| %>
  <%= f.text_filed :selection, :value => v %>
<% end %>

<% end %>

As you can see in the code above, "f" is outsi开发者_如何转开发de of the scope. Ideas?


f should still be in the scope. You misspelled text_field though.

0

精彩评论

暂无评论...
验证码 换一张
取 消