Skip to content

Instantly share code, notes, and snippets.

@betesh
Last active August 29, 2015 14:11
Show Gist options
  • Save betesh/f080b8a38ba7f476b2a0 to your computer and use it in GitHub Desktop.
Save betesh/f080b8a38ba7f476b2a0 to your computer and use it in GitHub Desktop.
rails-html-sanitizer gem breaks ActionMailer + ActionView + ActiveRecord - Rails 4.2.0 projects
require "active_record"
require "action_view/helpers"
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', dbfile: ':memory:')
# Alternative minimal implementation:
require "active_record"
require "action_mailer"
ActionMailer::Base.delivery_method = :test
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', dbfile: ':memory:')
source "https://rubygems.org"
gem "activerecord", "= 4.2.0"
gem "actionview", "= 4.2.0"
gem "sqlite3"
$ bundle exec ruby demo.rb
GEM_PATH/activerecord-4.2.0/lib/active_record/connection_handling.rb:3:in `block in <module:ConnectionHandling>': undefined method `env' for Rails:Module (NoMethodError)
from GEM_PATH/activerecord-4.2.0/lib/active_record/connection_handling.rb:4:in `call'
from GEM_PATH/activerecord-4.2.0/lib/active_record/connection_handling.rb:4:in `block in <module:ConnectionHandling>'
from GEM_PATH/activerecord-4.2.0/lib/active_record/connection_handling.rb:63:in `call'
from GEM_PATH/activerecord-4.2.0/lib/active_record/connection_handling.rb:63:in `initialize'
from GEM_PATH/activerecord-4.2.0/lib/active_record/core.rb:46:in `new'
from GEM_PATH/activerecord-4.2.0/lib/active_record/core.rb:46:in `configurations='
from GEM_PATH/activerecord-4.2.0/lib/active_record/core.rb:48:in `block in <module:Core>'
from GEM_PATH/activesupport-4.2.0/lib/active_support/concern.rb:120:in `class_eval'
from GEM_PATH/activesupport-4.2.0/lib/active_support/concern.rb:120:in `append_features'
from GEM_PATH/activerecord-4.2.0/lib/active_record/base.rb:285:in `include'
from GEM_PATH/activerecord-4.2.0/lib/active_record/base.rb:285:in `<class:Base>'
from GEM_PATH/activerecord-4.2.0/lib/active_record/base.rb:270:in `<module:ActiveRecord>'
from GEM_PATH/activerecord-4.2.0/lib/active_record/base.rb:26:in `<top (required)>'
from demo.rb:3:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment