I'm using the vanity gem to do some AB testing, but my report is all messed up. The auto-generated css and views have a width of 40em which I would like to change. Following the Vanity Documentation I ran
rails g vanity:views
which generated all the files needed, and have edited them accordingly. However, I am still not seeing the changes, and I can't figure out why rails is still using the defaults in the gem folder, and not those in the view.
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)
I even explicitly added the custom_template in the configuration file
#config/vanity.rb
Vanity.configure do |config|
config.templates_path = 'views/vanity'
end
Other files related to Vanity:
#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
All views are in :
#app/views/vanity/_report.erb
etc Thanks guys, any help would be grand.
This ended up being a mistake on my behalf (surprise).
Vanity doesn't take a config/vanity.rb
by default. It all needed to go in config/application.rb
Everything works fine now.