Sha256: 27c1952d7e868d1e79a9eb579cec100a2054e333ecc1fbf2adfcfc72a386fbbe

Contents?: true

Size: 623 Bytes

Versions: 8

Compression:

Stored size: 623 Bytes

Contents

require 'rails_generator'

class MailerGenerator < Rails::Generator::Base
  attr_reader :actions

  def generate
    @actions = args

    # Mailer class and unit test.
    template "mailer.rb", "app/models/#{file_name}.rb"
    template "unit_test.rb", "test/unit/#{file_name}_test.rb"

    # Test fixtures directory.
    FileUtils.mkdir_p "test/fixtures/#{table_name}"

    # View template and fixture for each action.
    args.each do |action|
      template "view.rhtml", "app/views/#{file_name}/#{action}.rhtml", binding
      template "fixture.rhtml", "test/fixtures/#{table_name}/#{action}", binding
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/rails-0.9.5/generators/mailer/mailer_generator.rb
rails-0.9.0 generators/mailer/mailer_generator.rb
rails-0.9.2 generators/mailer/mailer_generator.rb
rails-0.9.1 generators/mailer/mailer_generator.rb
rails-0.9.4.1 generators/mailer/mailer_generator.rb
rails-0.9.3 generators/mailer/mailer_generator.rb
rails-0.9.4 generators/mailer/mailer_generator.rb
rails-0.9.5 generators/mailer/mailer_generator.rb