Note that there are some explanatory texts on larger screens.

plurals
  1. PORails ActiveAdmin Layout was lost after overriding Controller action
    primarykey
    data
    text
    <p>Overriding a new controller without 'new!' does not display ActiveAdmin layout. But then when I added 'new!' nested 'synchronization' form is not appearing although I did '@resource.build_synchronization'. Not so sure what I'm doing wrong here.</p> <p>case #1 (ActiveAdmin layout is gone)</p> <pre><code>ActiveAdmin.register Resource do controller do # This code is evaluated within the controller class def new @resource = Resource.new @resource.build_synchronization end end end </code></pre> <p>case #2 (nested form synchronization does not appear)</p> <pre><code>ActiveAdmin.register Resource do controller do # This code is evaluated within the controller class def new @resource = Resource.new @resource.build_synchronization new! end end end </code></pre> <hr> <p>views\admin\resources\new.html.erb</p> <pre><code>&lt;%= semantic_form_for [:admin, @resource] do |form| %&gt; &lt;%= form.inputs "Resource", :id =&gt; "resource" do %&gt; &lt;%= form.input :name %&gt; &lt;%= form.semantic_fields_for :synchronization do |sync| %&gt; &lt;% sync.inputs :name =&gt; "Synchronization", :id =&gt; "synchronization" do %&gt; &lt;%= sync.input :start_datetime, :as =&gt; :datetime %&gt; &lt;%= sync.input :repeat_interval, :as =&gt; :radio, :collection =&gt; @intervals %&gt; &lt;%= sync.input :repeat_type, :as =&gt; :select, :collection =&gt; ["Manual", "Automatic"] %&gt; &lt;% end %&gt; &lt;% end %&gt; &lt;% end %&gt; &lt;%= form.buttons %&gt; &lt;% end %&gt; &lt;% end %&gt; </code></pre> <hr> <p>models:</p> <pre><code>class Resource &lt; ActiveRecord::Base has_one :synchronization accepts_nested_attributes_for :synchronization end class Synchronization &lt; ActiveRecord::Base belongs_to :resource has_many :mappings accepts_nested_attributes_for :mappings #validates_presence_of :start_datetime end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload