generators/rspec_dm_model/templates/model.rb in datamapper4rail-0.1.0 vs generators/rspec_dm_model/templates/model.rb in datamapper4rail-0.2.0

- old
+ new

@@ -1,16 +1,19 @@ class <%= class_name %> include DataMapper::Resource +<% if options[:add_constraints] -%> + include DataMapper::Constraints +<% end -%> + property :id, Serial <% for attribute in attributes -%> - property :<%= attribute.name %>, <%= attribute.type.to_s.camelize %>, :nullable => false <% if attribute.type == :string or attribute.type == :text -%>, :format => /^[^<'&">]*$/<% if attribute.type == :string %>, :length => 50<% end -%> -<% else -%> + property :<%= attribute.name %>, <%= attribute.type.to_s.camelize %>, :nullable => false <% if attribute.type == :string or attribute.type == :text -%>, :format => /^[^<'&">]*$/<% if attribute.type == :string %>, :length => 255<% end -%> +<% #else -%> <% end -%> <% end -%> <% unless options[:skip_timestamps] %> - property :created_at, DateTime, :nullable => false - property :updated_at, DateTime, :nullable => false + timestamps :at <% end -%> end