lib/rails/generators/neo4j/model/model_generator.rb in neo4j-3.0.0.alpha.3 vs lib/rails/generators/neo4j/model/model_generator.rb in neo4j-3.0.0.alpha.4
- old
+ new
@@ -29,24 +29,27 @@
end
def has_n_statements
txt = ""
options[:has_n].each do |key|
- to, from = key.split(':')
- txt << (from ? "\n has_n(:#{to}).from(:#{from})\n" : "\n has_n :#{to}")
+ txt << has_x('has_n', key)
end
txt
end
def has_one?
options[:has_one]
end
+ def has_x(method, key)
+ to, from = key.split(':')
+ (from ? "\n #{method}(:#{to}).from(:#{from})\n" : "\n #{method} :#{to}")
+ end
+
def has_one_statements
txt = ""
options[:has_one].each do |key|
- to, from = key.split(':')
- txt << (from ? "\n has_one(:#{to}).from(:#{from})\n" : "\n has_one :#{to}")
+ txt << has_x('has_one', key)
end
txt
end
def indices?
\ No newline at end of file