6

Вопрос по ruby-on-rails-3 – неопределенный метод has_many для Formtastic

Error: User Rate Limit Exceeded undefined method `has_many' for # Error: User Rate Limit Exceeded ActiveAdmin.register Ressource do form do |f| f.inputs do f.input :offer_id, :as => :hidden f.input ...

2 ответа

3

Error: User Rate Limit Exceeded

form :html => {:multipart => true} do |f|
end

Error: User Rate Limit Exceeded

<%= active_admin_form_for [:admin, @resource] ,:html => {:multipart => true} do |f|%>
<% end %>
14

Error: User Rate Limit Exceededhas_many (lib/active_admin/form_builder.rbError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

  1. If you don't need the extra has_many functionality (it looks like active_admin adds some javascript to make it easy to add a new record to the collection), then you can use stock formtastic. This example should work fine in the activeadmin file as well as in a partial:

    ActiveAdmin.register Ressource do
      form do |f|  
        # ...
        f.inputs :for => :roles do |app_f|
          # ...
          app_f.input :name, :include_blank => false
        end
        f.buttons
      end
    end 
    
  2. Use the ActiveAdmin form builder explicitly:

    <%= semantic_form_for [:admin, @resource], builder: ActiveAdmin::FormBuilder do |f| %>
      <!-- ... -->
    
      <%= f.has_many :teachers do |app_f| %>
        <%= app_f.inputs do %>
          <!-- ... -->
        <% end %>
      <% end %>
    
      <%= f.buttons %>
    <% end %>
    

Error: User Rate Limit Exceeded

Похожие вопросы