Sha256: 5eb6bbe66559ea1a1fe4c8bd677019a0ee7b00d0267ccfff527752418f7a2963

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

<% module_namespacing do -%>
class <%= class_name %> < <%= parent_class_name.classify %>
<% if options[:inheritable]-%>
  inheritable
<% end %>
<% attributes.each do |attribute| -%>
  field :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %>
<% end -%>
<% if options[:timestamps] %>
  timestamps
<% end -%>
<% attributes.select {|attr| attr.reference? }.each do |attribute| -%>
  belongs_to :<%= attribute.name %>
<% end -%>
<% if !accessible_attributes.empty? -%>
  attr_accessible <%= accessible_attributes.map {|a| ":#{a.name}" }.sort.join(', ') %>
<% else -%>
  # attr_accessible :title, :body
<% end -%>
end
<% end -%>





Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_record_schema-0.5.0 lib/generators/active_record_schema/model/templates/model.rb
active_record_schema-0.4.0 lib/generators/active_record_schema/model/templates/model.rb