我在rails 3应用程序中使用ActiveAdmin和acts_as_taggable,我可以将标记列表显示为编辑页面上的清单,我可以使用控制台添加标签,然后使用表单删除它们,但是它出错了如果我尝试添加标签,则保存表单
"验证失败:上下文不能为空"
我只有一个标记上下文(标签).
ActiveAdmin表单代码是:
form :html => { :multipart => true } do |f|
f.inputs "Details" do
f.input :title
f.input :itinerary, :as => :select, :collection => Itinerary.all
f.input :description
f.input :address
f.input :contact_details
f.input :url
f.input :phone
f.input :nearest_tube
f.input :timetable
f.input :price
f.input :tags, :as => :check_boxes, :multiple => true, :collection => @tags
f.input :image, :as => :file
end
f.buttons
end
Run Code Online (Sandbox Code Playgroud)
在我的模型中
class Ticket < ActiveRecord::Base
has_and_belongs_to_many :itinerary
acts_as_taggable_on :tags
has_attached_file :image, :styles => { :medium …Run Code Online (Sandbox Code Playgroud) 我正在管理一个网站,该网站目前正在运行一个非常标准的 varnish/apache 设置。客户端需要添加一个新域,该域从路径/查询字符串透明地提供服务,以便创建其站点的轻量级版本。例如:
用户访问 mobile.example.com,它指向与 example.com 相同的服务器
Varnish 将 mobile.example.com 请求重写为 example.com/mobile?theme=mobile
用户收到 apache 从 example.com/mobile?theme=mobile 提供的页面,但停留在 mobile.example.com
我们需要点击一个路径并在此处添加查询字符串,以及维护用户输入的任何路径,即:mobile.example.com/test 应在 example.com/mobile/test?theme=mobile 提供内容
使用 Varnish 4 执行此操作的任何提示?是否可以?