I have a form with several fields that aren't in my model but I'm not able to access them inside my controller.
My new
form is fairly simple and was generated with some rails scaffolding. It's inside my controller's create
method that I'm not able to access these params.
I've added the params with attr_accessor
to my controller, which looks something like:
class LittleClassSessionsController < ApplicationController
before_action :set_event_session, only: [:show, :edit, :update, :destroy]
attr_accessor :schedule_type
My view has a form field that looks like this. I can see the parameter's value being submitted in the console.
<select name="schedule_type" id="schedule_type">
<option value="1">Recurring— Create a series of class sessions in advance</option>
<option value="2">Not recurring— Create just one class session in advance</option>
</select>
I've added :schedule_type
to my whitelisted params. When trying to puts
the params to my console, it's not in there.
What am I missing?
via Chebli Mohamed