Sha256: 9c63a3aa3eb135ac991244b3bae56a1eae8b166c4a4c6cf585ec2efb6fc9c3ad

Contents?: true

Size: 917 Bytes

Versions: 15

Compression:

Stored size: 917 Bytes

Contents

require 'rails/generators/active_record'
require 'generators/devise/orm_helpers'

module ActiveRecord
  module Generators
    class DeviseGenerator < ActiveRecord::Generators::Base
      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"

      include Devise::Generators::OrmHelpers
      source_root File.expand_path("../templates", __FILE__)

      def generate_model
        invoke "active_record:model", [name], :migration => false unless model_exists?
      end

      def copy_devise_migration
        migration_template "migration.rb", "db/migrate/devise_create_#{table_name}"
      end

      def inject_devise_content
        inject_into_class model_path, class_name, model_contents + <<-CONTENT
  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me
CONTENT
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 5 rubygems

Version Path
devise-1.1.9 lib/generators/active_record/devise_generator.rb
devise-1.1.8 lib/generators/active_record/devise_generator.rb
devise-1.1.7 lib/generators/active_record/devise_generator.rb
devise-1.1.6 lib/generators/active_record/devise_generator.rb
devise-1.1.5 lib/generators/active_record/devise_generator.rb
devise-1.1.4 lib/generators/active_record/devise_generator.rb
devise-1.2.rc lib/generators/active_record/devise_generator.rb
aihs_devise-1.2.rc lib/generators/active_record/devise_generator.rb
gonow-devise-1.2.rc lib/generators/active_record/devise_generator.rb
devise-edge-1.2.rc lib/generators/active_record/devise_generator.rb
devise-1.1.3 lib/generators/active_record/devise_generator.rb
devise-1.1.2 lib/generators/active_record/devise_generator.rb
devise-1.1.1 lib/generators/active_record/devise_generator.rb
devise-1.1.0 lib/generators/active_record/devise_generator.rb
namxam-devise-1.1.0.win lib/generators/active_record/devise_generator.rb