我正在运行bundle install,我收到此错误:
Building nokogiri using system libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --use-system-libraries
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
--use-system-libraries …Run Code Online (Sandbox Code Playgroud) 我正在尝试用一些字段创建酒店,其中一个字段是照片,我想使用带有carrierwave和nested_form的多个文件上传.我找到了这篇文章 并得到了一些结果.
当我在/ hotels/new,填写字段,选择照片并按提交时,在HotelsController#中 获取ActiveRecord :: UnknownAttributeError会创建未知属性:attachable_type.安慰
Started POST "/hotels" for 127.0.0.1 at 2013-09-27 17:35:18 +0300
Processing by HotelsController#create as HTML
Parameters: {"utf8"=>"?", "authenticity_token"=>"+1T2tuygSnj8unOKkXkRWI4L7KvDE
9PPHrqvag7KmIQ=", "hotel"=>{"title"=>"dsa", "address"=>"asd", "star_rating"=>"2"
, "breakfast"=>"Not include", "price_for_room"=>"sadas", "room_description"=>"Gr
eat room", "attachments_attributes"=>{"1380289954031"=>{"file"=>#<ActionDispatch
::Http::UploadedFile:0xa5d546c @original_filename="11374.jpg", @content_type="im
age/jpeg", @headers="Content-Disposition: form-data; name=\"hotel[attachments_at
tributes][1380289954031][file]\"; filename=\"11374.jpg\"\r\nContent-Type: image/
jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20130927-7077-50zkol>>, "_destroy"
=>"false"}, "1380289972216"=>{"file"=>#<ActionDispatch::Http::UploadedFile:0xa5d
53a4 @original_filename="357175.jpg", @content_type="image/jpeg", @headers="Cont
ent-Disposition: form-data; name=\"hotel[attachments_attributes][1380289972216][
file]\"; filename=\"357175.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<F
ile:/tmp/RackMultipart20130927-7077-dlkmwk>>, "_destroy"=>"false"}}}, "commit"=>
"Done"}
Completed 500 Internal Server Error in 109ms
ActiveRecord::UnknownAttributeError …Run Code Online (Sandbox Code Playgroud) 我正在研究订阅续订功能,处于测试模式,测试付款方式。问题是我们收到取消订阅 webhook,GooglePlay 使订阅撤销。?? 从参数:
?"cancelReason": "1"
Run Code Online (Sandbox Code Playgroud)
文档中的状态代码,
例如,由于计费问题,系统取消了订阅。
也来自文档
撤销订阅会立即删除对订阅的访问权限,通常在您或 Google 怀疑存在欺诈时执行。
通常,它会在续订后立即发送取消 webhook,即使它成功了,所以我会收到两封关于续订成功和取消的电子邮件。在我的情况下,5 分钟后调用续订(文档)
有人想法,可能是什么原因?是不是一些“谷歌反欺诈系统”。因为出于测试目的,我们的订阅期短但价格高。但是当我们做测试,测试支付方式,没有真实交易时,可能不应该执行反欺诈。
android subscription auto-renewing google-play google-play-services
我有模型patient。当patient尝试注册时,他填写字段,例如:name、email、 ,并且对该字段telephone进行验证。presence我还有另一种表格,医生可以为自己添加患者,该表格只有一个字段name。
问题:我可以以某种方式跳过字段验证email,telephone但保留验证吗name?
目前,我有这个行动:
def add_doctor_patient
@patient = @doctor.patients.new(patient_params)
if params[:patient][:name].present? and @patient.save(validate: false)
redirect_to doctor_patients_path(@doctor), notice: 'Added new patient.'
else
render action: 'new'
end
end
Run Code Online (Sandbox Code Playgroud)
当nameparams 中存在时,我会跳过验证并保存患者,但是当name不存在时,它只会渲染new操作而不会出现错误,并且 simple_form 不会将字段标记为红色。也许有办法引发错误,或者只是另一种解决方案?
UPD
解决方案:遵循 Wintermeyer 的答案。由于我有关系patient belongs_to: doctor,我可以使用 - hidden_field_tag :doctor_id, value: @doctor.id,并像大家说的那样进行检查,unless: ->(patient){patient.doctor_id.present?}。PS 如果有人使用 devise,我们还应该跳过 和 上的 devise …
activerecord ×1
android ×1
bundle ×1
carrierwave ×1
google-play ×1
nested-forms ×1
nokogiri ×1
raiseerror ×1
rubygems ×1
subscription ×1
validation ×1