У меня есть эта ошибка:неверное число аргументов Контакт # создать
ArgumentError в контакт # создать
неверное число аргументов (данных 0, ожидается 2)
это показать мне эта линия с моего мнения
<%= @contact.errors.full_message.each do |message| %>
Мой метод создания в contact_contr Oller не принимать никаких аргументов
contact_controller.rb
def index
@contact = Contact.all
end
def create
@contact = Contact.new(contact_params)
if @contact.save
flash[:notice] = "Welcome"
redirect_to "/"
else
flash[:alert] = "You filled wrong the form"
render 'connection'
end
end
и я должен отображать эти сообщения из моей модели
contact.rb
validates :firstname, presence: true, length: { maximum: 30, minimum:2,
too_long: "30 characters is the maximum allowed.", too_short: "2 characters is the minimum allowed." }
validates :lastname, presence: true, length: { maximum: 50, minimum:2,
too_long: "50 characters is the maximum allowed.", too_short: "2 characters is the minimum allowed." }
VALID_EMAIL_REGEX = /\A[\w+\-.][email protected][a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, uniqueness: {message: "Email is already subscribed"}, length: { maximum: 40, minimum:7,
too_long: "40 characters is the maximum allowed.", too_short: "7 characters is the minimum allowed.",},
format: { with: VALID_EMAIL_REGEX }
validates :password, presence: true, length: { maximum: 30, minimum:6,
too_long: "30 characters is the maximum allowed.", too_short: "6 characters is the minimum allowed." }
я не понимаю, какие аргументы хочет Ruby. кто-нибудь знает, что это?
Является 'full_message' скорее чем 'full_messages' опечатка? Я предполагаю, что вы действительно не хотите 'full_message' –