【发布时间】:2018-05-25 21:07:23
【问题描述】:
我只是想根据电子邮件地址是否存在来更新记录的某些属性。
控制器:
def update
@contact = Contact.new(contact_params)
if @contact.update then
redirect_to :root, notice: 'yes was successfully updated.'
else
render "new"
end
render "show"
end
型号:
class Contact < ApplicationRecord
has_attached_file :image, styles: {large: "600x600>", medium: "300x300>", thumb: "150x150#"}
validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/
#validates :email, uniqueness: true
validates :email, presence: true
end }
绝对知道这有很多问题,希望得到一些帮助。
谢谢!
【问题讨论】:
标签: mysql ruby-on-rails ruby activerecord