I have a Rails app that is running fine on Rails 3.x and ActiveAdmin 0.6.6. However I want to upgrade it to Rails 5 and ActiveAdmin 1.x. I started the upgrade process first upgrading from 3.x to 4.x and then to 5x, and with ActiveAdmin I tested with 1.0.0 and now I'm using the master from Github.
Everything worked fine with the App in both Rails versions and ActiveAdmin but the ActiveAdmin forms that are in a partial.
The problem is the following:
I have a file app/admin/menu.rb
whose has a partial views/admin/menus/_form.html.erb
. The partial contains the form of the Menu.
This is the contents of the partial (views/admin/menus/_form.html.erb
):
<%= semantic_form_for [:admin, @menu], builder: ActiveAdmin::FormBuilder do |f| %>
<% f.inputs 'Campos Menu' do %>
<% f.input :project if current_admin_user.admin? %>
<% f.input :title %>
<% f.input :title_en %>
<% f.input :item %>
<% f.input :icon, as: :file %>
<% end %>
<% f.inputs 'Submenus' do %>
<% f.has_many :submenus, heading: '' do |fa| %>
<% fa.input :title, as: :string %>
<% fa.input :title_en, as: :string %>
<% fa.input :kind, as: :select, collection: Submenu.kind_collection %>
<% fa.input :items_as, as: :select, collection: Submenu.items_as_collection %>
<% end %>
<% end %>
<% f.actions do %>
<% f.action :submit %>
<% end %>
<% end %>
The render result of this file is only the 'actions' buttons, in this case the 'submit' button. The interesting thing is that if I remove the <% f.actions do %>...
from the partial then the <% f.inputs 'Submenus' do %>
gets rendered and the same if I remove the later. In other others is being rendered on the last block that contains an end
.
The same behaviour is being observed on Rails 4.x and 5.x (except Rails 5.1.x which I didn't tested).
If I move the form from the partial to the app/admin/menu.rb
it gets rendered properly. This could be a solution for me however I have others forms that make use of JQuery for fields manipulation and other stuff on the front end.
As I said before, all these forms partials were working properly on Rails 3.x and ActiveAdmin 0.6.6.
Anyone knows what's the problem?
DISCLAIMER: I'm not a Rails or ActiveAdmin expert, so bear with me if is a silly mistake related to this issue.
Aucun commentaire:
Enregistrer un commentaire