2014-06-12 2 views
0

레일 4에서 레일 4로 프로젝트를 업그레이드했습니다. 레일 4로 전환했을 때 로그에서이 오류를 만났습니다. 그러나 나는이 방법에 어떤 논증도하지 않았다.레일 4 뷰 도우미 : 잘못된 인수 수

ActionView::Template::Error (wrong number of arguments (1 for 0)): 
    1: <div id="titles_list"> 
    2: 
    3: <div id="admin_title_select_group"> 
    4:  <% table_group = select_table_group %> 
    5:  <%= select_tag 'selected_group', options_for_select(table_group, by_default_selected_group) %> 
    6: </div> 
    7: 
    app/helpers/admin/titles_helper.rb:14:in `select_table_group' 
    app/views/admin/titles/index.html.erb:4:in `_app_views_admin_titles_index_html_erb__3791160006166460542_70179046974220' 
    lib/metal/search_store.rb:17:in `call' 

index.html.erb

다음
<div id="titles_list"> 

    <div id="admin_title_select_group"> 
    <% table_group = select_table_group %> 
    <%= select_tag 'selected_group', options_for_select(table_group, by_default_selected_group) %> 
    </div> 
... 

내 도우미 메서드입니다 :

module Admin::TitlesHelper 

    def select_table_group 
    g = [[I18n.t('admin.tpgn.select_group'),0]] 
    g += TitleProviderGroupName.all(:order => :name).collect{|t| [ t.name, t.id ]} 

    end 

    def by_default_selected_group 
    if params[:tpgn_id] 
     params[:tpgn_id] 
    else 
     0 
    end 
    end 

end 

그것이 레일 3. 잘 레일 4 도우미 방법에 대한 변경이 작동? 나는 이것에 대한 어떤 정보도 찾지 못했다.

+1

titles_helper.rb''라인이 14 인으로 변경해야한다? –

+0

'g + = TitleProviderGroupName.all (: order => : name) .collect {| t | [t.name, t.id]}'아, 감사합니다. 문제는 Model.all이 더 이상 인수를 받아들이지 않는다고 생각했습니다. – tzzzoz

답변

5

all 방법은

TitleProviderGroupName.all 

레일 4에 매개 변수를 고려하지 않습니다는

TitleProviderGroupName.order(:name) 
+1

고마워, 나는 그것을 발견 :) – tzzzoz

관련 문제