Sha256: 09a25c5f348c0020a6fe3f88ae6ce5ab00eb65d4b9c3088c939e076cc662dae3

Contents?: true

Size: 888 Bytes

Versions: 6

Compression:

Stored size: 888 Bytes

Contents

class <%= class_name %>
  include DataMapper::Resource

  property :id, Serial
<% Array(attributes).each do |attribute| -%>
  property :<%= attribute.name %>, <%= attribute.type.to_s.capitalize %>, :nullable => false <% if attribute.type == :string or attribute.type == :text or attribute.type == :slug -%>, :format => /^[^<'&">]*$/<% if attribute.type == :string or attribute.type == :slug %>, :length => 255<% end -%><% end -%>

<% end -%>
<% unless options[:skip_timestamps] -%>
  timestamps :at
<% end -%>

<% unless options[:skip_modified_by] -%>
  modified_by "Ixtlan::Models::User"

  require 'dm-serializer'
  alias :to_x :to_xml_document
  def to_xml_document(opts = {}, doc = nil)
    unless(opts[:methods])
      opts.merge!({:methods => [:updated_by], :updated_by => {:methods => [], :exclude => [:created_at, :updated_at]}})
    end
    to_x(opts, doc)
  end
<% end -%>

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ixtlan-0.4.0.pre2 generators/ixtlan_datamapper_model/templates/model.rb
ixtlan-0.4.0.pre generators/ixtlan_datamapper_model/templates/model.rb
ixtlan-0.3.0 generators/ixtlan_datamapper_model/templates/model.rb
ixtlan-0.2.4 generators/ixtlan_datamapper_model/templates/model.rb
ixtlan-0.2.3 generators/ixtlan_datamapper_model/templates/model.rb
ixtlan-0.2.2 generators/ixtlan_datamapper_model/templates/model.rb