2015-10-03 45 views
0

我有一個應用程序與rails4,activeadmin和simpleform。我改變了我的simple_form.rb配置。從那時起,當我訪問本地主機:3000 /管理/登錄,我得到:ActionView :: Template :: Error(錯誤數量的參數(6爲4..5))與rails,活動管理和簡單的形式

ActionView::Template::Error (wrong number of arguments (6 for 4..5)): 
    5: <%= active_admin_form_for(resource, :as => resource_name, :url => send(:"#{scope}_session_path"), :html => { :id => "session_new" }) do |f| 
    6:  f.inputs do 
    7:  resource.class.authentication_keys.each { |key| f.input key, :input_html => {:autofocus => true}} 
    8:  f.input :password 
    9:  f.input :remember_me, :label => t('active_admin.devise.login.remember_me'), :as => :boolean, :if => false #devise_mapping.rememberable? } 
    10:  end 
    11:  f.actions do 
    simple_form (2.1.0) lib/simple_form/inputs/base.rb:50:in `initialize' 
    formtastic (2.2.1) lib/formtastic/helpers/input_helper.rb:240:in `new' 
    formtastic (2.2.1) lib/formtastic/helpers/input_helper.rb:240:in `input' 
... 

Gemfile.lock的:

... 
rails (3.2.13) 
activeadmin (0.6.0) 
formtastic (2.2.1) 
simple_form (2.1.0) 

是什麼造成的錯誤?

回答

0

關於此主題:https://github.com/activeadmin/activeadmin/issues/2703,SpecialCyCi有一個解決此問題的黑客。

截至config/initializers/simple_form.rb頂部,把下面的:

inputs = %w[ 
    CollectionSelectInput 
    DateTimeInput 
    FileInput 
    GroupedCollectionSelectInput 
    NumericInput 
    PasswordInput 
    RangeInput 
    StringInput 
    TextInput 
] 

inputs.each do |input_type| 
    superclass = "SimpleForm::Inputs::#{input_type}" 
    hack = %| 
    module SimpleForm 
     module Inputs 
     class #{superclass} 
      def input_html_classes 
      super.push('form-control') 
      end 
     end 
     end 
    end 
    | 
    eval(hack) 

end 

SimpleForm.setup do |config| 
    # your config here... 
    # ... 
end 
相關問題