我正在使用虚荣宝石来做一些AB测试,但我的报告都搞砸了。自动生成的CSS和视图的宽度为40em,我想改变它。继Vanity Documentation 我跑被忽略的自定义浮雕视图
rails g vanity:views
其产生所需的所有文件,并相应地编辑它们。 但是,我仍然没有看到更改,我不明白为什么rails仍然使用gem文件夹中的默认值,而不是视图中的默认值。
Started GET "/vanity" for ::1 at 2016-11-21 12:07:19 -0500 Processing by VanityController#index as HTML W, [2016-11-21T12:07:19.231036 #2616] WARN -- : No default alternative specified; choosing school_lower as default. AdminUser Load (1.4ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = $1 ORDER BY "admin_users"."id" ASC LIMIT 1 [["id", 32]] Rendered /Users/lowellmower/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/vanity-2.2.6/lib/vanity/templates/_ab_test.erb (754.1ms) Rendered /Users/lowellmower/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/vanity-2.2.6/lib/vanity/templates/_experiment.erb (1013.5ms)
我甚至明确地在配置文件中添加的custom_template
与虚荣#config/vanity.rb Vanity.configure do |config| config.templates_path = 'views/vanity' end
其他文件:
#routes.rb get '/vanity' =>'vanity#index' get '/vanity/participant/:id' => 'vanity#participant' post '/vanity/complete' post '/vanity/chooses' post '/vanity/reset' post '/vanity/enable' post '/vanity/disable' post '/vanity/add_participant' get '/vanity/image'
#app/controllers/vanity_controller.rb
class VanityController < ApplicationController
include Vanity::Rails::Dashboard
layout false # exclude this if you want to use your application layout
before_action :authenticate_admin_user!
end
层所有的观点都是:
#app/views/vanity/_report.erb
等 感谢球员,任何帮助将是盛大的。
这里的贡献者 - 很高兴你想出了它,任何方式的文档/自述文件可以更清晰? – phillbaker
啊,不要以为你可以。这对我来说是一个疏忽,如果我的记忆服务于这些文档,就说它放在application.rb中,然后我继续将它放在vanity.rb中。 –