Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4004

actionview ~> 4.2 triggers false Rails detection in Sinatra app

    • Type: Icon: Task Task
    • Resolution: Done
    • 5.0.0
    • Affects Version/s: None
    • Component/s: None
    • None

      I'm using actionview in a Sinatra app and noticed a regression during Mongoid.load! from actionview 4.1.6 to 4.2 which pulls in a couple of rails-* gems,

      actionview (4.2.1)
      activesupport (= 4.2.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)

      They are listed as dependencies in actionview 4.1.6 but not loaded it seems.

      shared/bundle/ruby/2.0.0/gems/mongoid-4.0.2/lib/mongoid/config/environment.rb:22:in {{env_name': undefined method }}env' for Rails:Module (NoMethodError)
      from shared/bundle/ruby/2.0.0/gems/mongoid-4.0.2/lib/mongoid/config/environment.rb:39:in `load_yaml'

      Rails gets defined by these rails-* gem confusing mongoid into thinking it's a rails app but Rails.env isn't defined. A && defined?(Rails.env) would catch it.

      Workaround is gem 'actionview', '~> 4.1.0' in Gemfile.

            Assignee:
            Unassigned Unassigned
            Reporter:
            paulmakepeace Paul Makepeace
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: