title: Rails 4 Nested Form "Unpermitted Parameters" Not Answered Anywhere Else
body: <p>My nested form is not working properly no matter what I try and I searched all the StackExchange's for a solution to this seemingly easy problem. This is where I am right now to get it to work at show up in the view at all.</p>
  
  <p>The form is using the Event controller create action from a non-restful location, hence the global variable (a pages controller, with a specific page, where the form is generated). My ticket model gets generated when the nested form is submitted, and the Event ID gets passed, but it doesn't fill in the "Name" field for the ticket model because it says "Unpermitted Parameters: Ticket." But they're defined as whitelisted in the Events controller! Argh! I'm thinking something is wrong with the form, but nothing I try seems to work.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p><strong>* UPDATED CODE THAT IS NOW WORKING *</strong></p>
  
  <p>Form.html.erb:</p>
  
  <pre><code>&lt;div class="form-inputs"&gt;
   &lt;%= simple_form_for @event, :html =&gt; { :class =&gt; 'form-horizontal' } do |f| %&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-xs-6"&gt;
       &lt;%= f.input :name, class: "control-label" %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="row"&gt;
     &lt;div class="col-xs-6"&gt;
      &lt;%= f.simple_fields_for :tickets do |ticket| %&gt;
       &lt;%= ticket.input :name %&gt;
      &lt;% end %&gt;
     &lt;/div&gt;
   &lt;/div&gt;
   &lt;div class="form-actions"&gt;
    &lt;%= f.button :submit, :class =&gt; 'btn-primary' %&gt;
     &lt;%= link_to t('.cancel', :default =&gt; t("helpers.links.cancel")),
                  launchpad_path, :class =&gt; 'btn btn-default' %&gt;
    &lt;% end %&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Event_Controller.rb</p>
  
  <pre><code>def new (this is totally skipped and unnecessary)
    @event = Event.new
    @ticket = @event.tickets.build
  end    
  
  def create
    @event = current_user.events.build(event_params)
  
    respond_to do |format|
     if @event.save
      format.html { redirect_to @event, notice: 'Your event was created.' }
     else
      format.html { render :new }
     end
   end
  end
  
  def event_params
    params.require(:event).permit(:name, tickets_attributes: [ :name, :id, :event_id, :_destroy ])
  end
  </code></pre>
  
  <p>Pages_Controller.rb (where the form originate</p>
  
  <pre><code> def new
    @event = Event.new
    @ticket = @event.tickets.build
   end
  </code></pre>
  
  <p>Event.rb</p>
  
  <pre><code>class Event &lt; ActiveRecord::Base
      # Database Relationships
      has_many :tickets, dependent: :destroy
      accepts_nested_attributes_for :tickets, :allow_destroy =&gt; true
  end
  </code></pre>
  
  <p>Ticket.rb</p>
  
  <pre><code>class Ticket &lt; ActiveRecord::Base
      belongs_to :event
  end
  </code></pre>
  
  <p>Routes.rb</p>
  
  <pre><code>resources :events do
   resources :tickets
  end
  </code></pre>