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.8.5 lib/scaffolds/basic/models/model.rb
effective_developer-0.8.5 lib/scaffolds/admin_effective/models/model.rb
effective_developer-0.8.5 lib/scaffolds/effective/models/model.rb
effective_developer-0.8.4 lib/scaffolds/basic/models/model.rb
effective_developer-0.8.4 lib/scaffolds/effective/models/model.rb
effective_developer-0.8.4 lib/scaffolds/admin_effective/models/model.rb
effective_developer-0.8.3 lib/scaffolds/basic/models/model.rb
effective_developer-0.8.3 lib/scaffolds/effective/models/model.rb
effective_developer-0.8.3 lib/scaffolds/admin_effective/models/model.rb
effective_developer-0.8.2 lib/scaffolds/admin_effective/models/model.rb
effective_developer-0.8.2 lib/scaffolds/basic/models/model.rb
effective_developer-0.8.2 lib/scaffolds/effective/models/model.rb
effective_developer-0.8.1 lib/scaffolds/effective/models/model.rb
effective_developer-0.8.1 lib/scaffolds/admin_effective/models/model.rb
effective_developer-0.8.1 lib/scaffolds/basic/models/model.rb
effective_developer-0.8.0 lib/scaffolds/admin_effective/models/model.rb
effective_developer-0.8.0 lib/scaffolds/effective/models/model.rb
effective_developer-0.8.0 lib/scaffolds/basic/models/model.rb
effective_developer-0.7.8 lib/scaffolds/admin_effective/models/model.rb
effective_developer-0.7.8 lib/scaffolds/effective/models/model.rb