My rails app has its own MySql database (and requires the mysql2 gem) but also needs to connect with an external MongoDB database for one particular model (and so I've included mongoid and bson_ext in the Gemfile). Now when I try to generate a migration for a new model, it tells me that
$ rails g migration CreateLocations
       error  mongoid [not found]
When I generated the Location model it included Mongoid::Document, so Rails obviously thinks it is using the external database as my primary datastore.
databse.yml:
development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: associalize_development
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock
mongoid.yml:
development:
  host: pearl.mongohq.com
  port: 27019
  username: asfasdf
  password: sadfasdf
  database: app4574678
test:
  host: pearl.mongohq.com
  port: 27019
  username: asdfadhasdfa
  password: hadsadfas
  database: app4574678
production:
  host: pearl.mongohq.com
  port: 27019
  username: asdfdfsasda
  password: afdasdfdasdf
  database: app4574678
UPDATE Model that uses Mongo
class ExternalMongoModel
  include Mongoid::Document
  field :title
  field :long_title
  field :deal_type
  field :merchandise_type
  field :market_id
  field :market_name
  field :market_location, type: Array
  field :featureType
  field :country_code
  field :subtitle
  field :offer_ends_at
  field :price
  field :value
  field :merchant_type
  field :content
  field :merchant
  index(
    [[:division_latlon, Mongo::GEO2D]], background: true
  )
end
 
     
     
     
    