我正在使用虛榮寶石來做一些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中。 –