我在服务器A中使用虚荣心,但是对于仪表板,我想在服务器B上显示它。
已采取的步骤:
但当我来到本地时,我所看到的一切:3000/虚荣心是一个只有“虚荣心生成”的页面。
我也需要添加实验文件吗?但是我不想把它们复制到服务器B中,因为它已经在服务器A中了。我只需要在服务器B中显示仪表板。
发布于 2016-06-11 20:57:43
虚荣心确实使用实验文件作为替代值等事物的真相来源,因此复制这些文件将是最直接的方法。(也许一个git子模块可以帮助它们保持在一个位置上?)
如果有些问题还可以的话,这可能在只读应用程序中有效:
# config/initializers/vanity.rb
::Rails.configuration.after_initialize do
Vanity::Adapters::ActiveRecordAdapter::VanityExperiment.all.each do |experiment|
id = experiment.experiment_id
experiment = Vanity::Experiment::AbTest.new(Vanity.playground, id, id.humanize)
experiment.default(Vanity::Adapters::ActiveRecordAdapter::VanityParticipant.where(experiment_id: id).first.seen)
used_alternatives = Vanity::Adapters::ActiveRecordAdapter::VanityParticipant.where(experiment_id: id).pluck(:seen).uniq
if used_alternatives.size >= 2
# If we have at least 2 alternatives, set them, otherwise use the default true/false
experiment.alternatives(*used_alternatives)
end
Vanity.playground.experiments[id] = experiment
end
end
这将从数据库中提取可用的信息(因此没有备选方案的名称,它只是在实验文件中有替代方案的索引号),并做了一些假设,但似乎加载了数据。
https://stackoverflow.com/questions/37653055
复制相似问题