开发者

hash enumeration and using outside arguments

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜