Sha256: 1ebfa6dc65e8da2704a712a2777f54fd98f929f1d26c0cd55e8f231be9b8db8a

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

module Bowline::Generators
  class ModelGenerator < NamedGenerator
    desc <<-DESC
      Generates a new model.
    DESC
    
    def class_name
      if local
        super + " < SuperModel::Base"
      else
        super + " < ActiveRecord::Base"
      end
    end
    
    def modules
      []
    end
    
    first_argument :name, :required => true, :desc => "model name"
    second_argument :local, :required => false
    
    template :model do |template|
      template.source       = "model.rb"
      template.destination  = "app/models/#{file_name}.rb"
    end
  end
  
  add :model, ModelGenerator
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bowline-0.6.3 lib/bowline/generators/model.rb
bowline-0.6.2 lib/bowline/generators/model.rb
bowline-0.6.1 lib/bowline/generators/model.rb
bowline-0.6.0 lib/bowline/generators/model.rb