У меня есть форма контакта в моем проекте с Ruby on Rails (Ruby 2.4.0 и Rails 5.2.0). При попытке отправить форму возникает следующая ошибка:
Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
ActiveModel::ForbiddenAttributesError - ActiveModel::ForbiddenAttributesError:
app/controllers/contacts_controller.rb:7:in `create'
Я подозреваю, что в контроллере контактов есть ошибки, как говорится в ошибке.
contacts_controller.rb
class ContactsController < InheritedResources::Base
def index
end
def create
@contact = Contact.new(params[:contact])
if @contact.save
ContactMailer.delay_for(10.seconds, retry: true).create(@contact)
render nothing: true, status: 200
else
render nothing: true, status: 400
end
end
end
В некоторых старых версиях Ruby и Rails один и тот же код работает нормально. Что-нибудь изменилось в последних версиях? Кто-нибудь может мне помочь?
Спасибо.