Sha256: 912cdc84df99b70352dfbe7c1757c71c524c8b03c04eebf21d05e771ca569923

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

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

class Neo4j::Generators::ModelGenerator < Neo4j::Generators::Base
	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.rb", 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, DateTime
# property :created_on, Date

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neo4j-1.0.0.beta.19 lib/generators/neo4j/model/model_generator.rb
neo4j-1.0.0.beta.18 lib/generators/neo4j/model/model_generator.rb