Ruby on rails 联系人视图未使用rails中的邮件表单gem从联系人/新视图更新

Ruby on rails 联系人视图未使用rails中的邮件表单gem从联系人/新视图更新,ruby-on-rails,contact,contact-form,Ruby On Rails,Contact,Contact Form,我正在处理邮件表单gem。我已经为联系人表单创建了一个特定的控制器,everythink似乎是正确的,但是当我提交任何表单时,视图不会从创建一个更改为创建一个,但是url会更改。它显示localhost3000/gmm/contacts(已从localhost3000/gmm/contacts/new更改)。我担心这个问题,;此外,新视图在名称字段中显示电子邮件,如图所示: “” 我想一定是post-verb或我的路由有问题,但我做了几次rake:routes,没有任何进展。非常感谢你的帮助。我

我正在处理邮件表单gem。我已经为联系人表单创建了一个特定的控制器,everythink似乎是正确的,但是当我提交任何表单时,视图不会从创建一个更改为创建一个,但是url会更改。它显示localhost3000/gmm/contacts(已从localhost3000/gmm/contacts/new更改)。我担心这个问题,;此外,新视图在名称字段中显示电子邮件,如图所示:

“”


我想一定是post-verb或我的路由有问题,但我做了几次rake:routes,没有任何进展。非常感谢你的帮助。我非常感谢

在名称字段中显示电子邮件的答案是,您实际上是在将电子邮件保存到名称字段中

从以下位置更改电子邮件字段:

<%= f.email_field :name, required: true, :class => "form-control", :placeholder => "Email" %>

在“名称”字段中显示的电子邮件的答案是,您实际上正在将电子邮件保存到“名称”字段中

从以下位置更改电子邮件字段:

<%= f.email_field :name, required: true, :class => "form-control", :placeholder => "Email" %>

非常感谢,我有点困了,我已经把:名称改为:email,现在它可以工作了。谢谢:)非常感谢。我有点困了。我把:名字改成了:email,现在可以用了。谢谢:)
         class Contact<MailForm::Base
attribute :name,    :validate => true
attribute :email,   :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
attribute :message, :validate => true
attribute :nickname,:captcha => true

def headers
    {
    :subject => "Contact Form",
    :to => "kurtco_91@hotmail.com",
    :to => "yomi.89gm@gmail.com",
    :from => %("#{name}" <#email>)
    }
end
      Rails.application.routes.draw do

           resources :contacts, only: [:new,:create]

          get 'gmm/home' 

          get 'gmm/about'

          get 'gmm/services'

          get 'gmm/contact'

          get '/change_locale/:locale', to: 'settings#change_locale', as: :change_locale
<%= f.email_field :name, required: true, :class => "form-control", :placeholder => "Email" %>
<%= f.email_field :email, required: true, :class => "form-control", :placeholder => "Email" %>
def create
@contact=Contact.new(params[:contact])
@contact.request=request
if @contact.deliver
    flash.now[:error]=nil
else
    flash.now[:error]='Cannot send message.'
    redirect_to new_contact_path
end
end