Sha256: a1370854cc2b3a7cd1d48279f361e66002f71950e5562e4a540526ed25821f31

Contents?: true

Size: 881 Bytes

Versions: 1

Compression:

Stored size: 881 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'neo4j.rb')

class Neo4j::Generators::ModelGenerator < Neo4j::Generators::Base #:nodoc:
	argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
	
	check_class_collision
	
	class_option :timestamps, :type => :boolean
	class_option :parent,     :type => :string, :desc => "The parent class for the generated model"
	
	def create_model_file
		template "model.erb", File.join('app/models', "#{singular_name}.rb")
	end
	
	protected
	def migration?
		false
	end
	
	def timestamps?
		options[:timestamps]
	end
	
	def parent?
		options[:parent]
	end
	
	def timestamp_statements
		%q{
  property :created_at, :type => DateTime
  # property :created_on, :type => Date

  property :updated_at, :type => DateTime
  # property :updated_on, :type => Date
}            
	end
	
	hook_for :test_framework
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neo4j-1.2.5-java lib/generators/neo4j/model/model_generator.rb