相关疑难解决方法(0)

如何将country_select gem与best_in_place编辑集成

我使用best_in_place gem来编辑内联和country_select记录,以呈现可供选择的国家列表.使用best_in_place编辑选择字段时,我这样做:

<%= best_in_place(@home, :country_name, :type => :select, :collection => [[1, "Spain"], [2, "Italy"]]) %>
Run Code Online (Sandbox Code Playgroud)

现在,我想获得country_select所有国家/地区的列表,并将其传递到collection参数中.country_select gem提供了一个简单的帮助器来呈现select字段:

<%= country_select("home", "country_name") %>
Run Code Online (Sandbox Code Playgroud)

我想替换best_in_place帮助器中的:collection参数,以包含country_select提供的国家列表.我知道best_in_place期望[[key,value],[key,value],...]输入:collection,但我不知道如何做到这一点.请指教.谢谢

inline-editing ruby-on-rails-3 best-in-place

3
推荐指数
1
解决办法
1136
查看次数