когда я отправляю данные формы, я получаю:
NoMethodError (неопределенный метод `allow 'для" create ": String):
app / controllers / actions_controller.rb: 53: inaction_params'
app/controllers/actions_controller.rb:18:in
create '
Это форма:
= controlled_form do
= render 'shared/error_messages', object: @action
= remote_form(@action, html: { id: "actionsForm" }) do |f|
= input_group "fas fa-file-alt" do
= f.text_field :name, \
autofocus: true, \
placeholder: t('actions.form.name'), \
class: "form-control"
= input_group 'fas fa-file-alt' do
= f.text_area :description, \
placeholder: t('actions.form.description'), \
class: "form-control"
и функция создания:
def create
@action = Action.new(action_params)
if @action.save
flash[:success] = "\"#{@action.name}\" was created"
respond_to do |format|
format.js { render js: "Turbolinks.visit('#{actions_path}')" }
end
else
render_form status: :bad_request
end
end
наконец:
def action_params
params.require(:action).permit(:name, :description)
end