0

我迷路了,似乎无法在任何地方找到解决方案......

我想要做的就是当他们通过外部 API 提交表单时,能够在我的用户名前面添加一个小问候语......所以没有任何东西被保存到我的数据库中

我想做的就是这个

 "Web inquiry from Jon Doe"

所以我有一个表格

  <%= text_field :subject %>

当用户将他的名字放入其中并提交表单时,我的客户可以转到发布它的外部网站并查看

 "Web inquiry from Jon Doe"

所以我只需要能够解决

 Web inquiry from 

表格上的名字的一部分?

请帮助我......你我唯一的希望

这是我的控制器

class Website::ContactsController < Website::WebsiteApplicationController
  def new
    @contacts = Form.new
  end

  def create
    @contacts = Form.new(params[:contacts])
    @contacts.post_tickets(params[:contacts])
    if @contacts.valid?
      flash[:success] = "Message sent! Thank you for conacting us."
      redirect_to new_contact_path
    else
      flash[:alert] = "Please fill in the required fields"
      render action: 'new'
    end
  end
end

这是我的表格

 = form_for(:contacts, url: contacts_path) do |f| 
   = f.error_messages
   = f.label :subject, "Name"
   %span{style: 'color: red'} *
   = f.text_field :subject, class: "text_field width_100_percent"
    %br
    %br    
    = f.label "Email"
    %span{style: 'color: red'} *
    %br    
    = f.email_field :email, class: "text_field width_100_percent"
    %br
    %br
    = f.label "Phone"
    %br    
    = f.text_field :custom_field_phone_number_28445, name: 'contacts[custom_field][phone_number_28445]', class: "text_field width_100_percent"
    %br
    %br
    = f.label "Company"
    %br    
    = f.text_field :custom_field_company_28445, name: 'contacts[custom_field][company_28445]', class: "text_field width_100_percent"
    %br
    %br
    = f.label "Question(s), and/or feedback"
    %span{style: 'color: red'} *
    %br
    = f.text_area :description, class: "text_field width_100_percent", style: 'height: 100px;'
    %br
    %br
    = f.submit "Submit", class: 'btn btn-warning'
4

1 回答 1

0

这还不够吗?

message = "Web inquiry from " + params[:subject]
于 2013-09-10T20:25:35.827 回答