Sha256: 108284a022eeb2206be78ededd00a50ed5b68271646a7b328aa25e05caf4c53d

Contents?: true

Size: 723 Bytes

Versions: 91

Compression:

Stored size: 723 Bytes

Contents

<% module_namespacing do -%>
class <%= resource.class_name %> < <%= parent_class_name.classify %>
<% resource.belong_tos.each do || ass -%>
  belongs_to :<%= ass.name %><%= ', polymorphic: true' if ass.polymorphic? %>
<% end -%>

  effective_resource do
<% invoked_attributes.each do |name, (type, _)| -%>
    <%= name.to_s.ljust(max_attribute_name_length) %> :<%= type %>
<% end -%>

    timestamps
  end

  scope :deep, -> { all }

<% invoked_attributes.each do |name, (type, _)| -%>
  validates :<%= name %>, presence: true
<% end -%>

  def to_s
<% if to_s_attribute.present? -%>
    <%= to_s_attribute %> || 'New <%= resource.human_name %>'
<% else %>
    '<%= resource.human_name %>'
<% end -%>
  end

end
<% end -%>

Version data entries

91 entries across 55 versions & 1 rubygems

Version Path
effective_developer-0.6.8 lib/scaffolds/models/model.rb
effective_developer-0.6.7 lib/scaffolds/models/model.rb
effective_developer-0.6.6 lib/scaffolds/models/model.rb
effective_developer-0.6.5 lib/scaffolds/models/model.rb
effective_developer-0.6.4 lib/scaffolds/models/model.rb
effective_developer-0.6.3 lib/scaffolds/models/model.rb
effective_developer-0.6.2 lib/scaffolds/models/model.rb
effective_developer-0.6.1 lib/scaffolds/models/model.rb
effective_developer-0.6.0 lib/scaffolds/models/model.rb
effective_developer-0.5.5 lib/scaffolds/models/model.rb
effective_developer-0.5.4 lib/scaffolds/models/model.rb
effective_developer-0.5.3 lib/scaffolds/models/model.rb
effective_developer-0.5.2 lib/scaffolds/models/model.rb
effective_developer-0.5.1 lib/scaffolds/models/model.rb
effective_developer-0.5.0 lib/scaffolds/models/model.rb
effective_developer-0.4.16 lib/scaffolds/models/model.rb
effective_developer-0.4.15 lib/scaffolds/models/model.rb
effective_developer-0.4.14 lib/scaffolds/models/model.rb
effective_developer-0.4.13 lib/scaffolds/models/model.rb
effective_developer-0.4.12 lib/scaffolds/models/model.rb