Sha256: a1351fc285a210609c8e5e68ced71ba9b351ea5a2d3cfed7fe86c0c2f34ca039

Contents?: true

Size: 730 Bytes

Versions: 3

Compression:

Stored size: 730 Bytes

Contents

require 'generators/devise/orm_helpers'
require 'sugar-high/file'

module MongoMapper
  module Generators
    class DeviseGenerator < Rails::Generators::NamedBase
      include Devise::Generators::OrmHelpers

      def generate_model
        invoke "mongo_mapper:model", [name] unless model_exists?
      end

      def inject_devise_content        
        inject_into_file model_path, model_contents, :after => "include MongoMapper::Document\n"
      end

      def replace_default_devise_orm        
        devise_init_file = File.join(Rails.root, 'config', 'initializers', 'devise.rb')
        File.replace_content_from devise_init_file, :where => 'orm/active_record', :with => 'orm/mongo_mapper'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mm-devise-1.1.8 lib/generators/mongo_mapper/devise_generator.rb
mm-devise-1.1.7 lib/generators/mongo_mapper/devise_generator.rb
mm-devise-1.1.6 lib/generators/mongo_mapper/devise_generator.rb