0
votes

I am using Rails 4.0.4 and Ruby 2.1.1. I made few changes in my devise login form after generating migration for username and find the ActiveAdmin is throwing following error.

Showing /Users/MyCom/.rvm/gems/ruby-2.1.1/bundler/gems/active_admin-3136ccb910e8/app/views/active_admin/devise/sessions/new.html.erb where line #8 raised:

wrong number of arguments (6 for 4..5)

Extracted source (around line #8):

 <%= active_admin_form_for(resource, :as => resource_name, :url => send(:"#{scope}_session_path"), :html => { :id => "session_new" }) do |f|
   f.inputs do
     resource.class.authentication_keys.each { |key| 
       f.input key, :label => t('active_admin.devise.'+key.to_s+'.title'), :input_html => {:autofocus => true}
     }
     f.input :password, :label => t('active_admin.devise.password.title')
     f.input :remember_me, :label => t('active_admin.devise.login.remember_me'), :as => :boolean if devise_mapping.rememberable?

Following is my code in views/devise/sessions/new

<div class="panel-body">
<div class="col-md-6">
<%= simple_form_for(resource, :as => resource_name, :url =>  session_path(resource_name)) do |f| %>

                  <div class="form-group">
                    <%= f.label :username %>
                    <%= f.input_field :username, class: "form-control", :autofocus => true %>
                  </div>

                  <div class="form-group">
                    <%= f.label :password %>
                    <%= f.password_field :password, class: "form-control" %>
                  </div>

                  <div class="form-group">
                    <div class="checkbox">
                      <%= f.check_box :remember_me %>
                      <%= f.label :remember_me %>
                    </div>
                  </div>

                  <div class="form-group">
                    <%= f.submit "Sign in", class: "btn btn-primary" %>
                  </div>
                <% end %>
            </div>
      </div>
1

1 Answers

1
votes

I was able to fix doing the following. I had to change my config/initializers/simple_form_bootstrap.rb file. I had added following which I had to take it out.

inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
]
inputs.each do |input_type|
superclass = "SimpleForm::Inputs::#{input_type}".constantize
new_class = Class.new(superclass) do
def input_html_classes
super.push('form-control')
end
end
Object.const_set(input_type, new_class)
end

This issue is discussed in details here.

https://github.com/gregbell/active_admin/issues/2703