Sha256: 27f6427b26034263d81b14a5f4cc8d5c70642ead184e2f195667b1683092ec2e

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

package <%= base_package %>.models {
<% if has_manies.length > 0 -%>
  import org.ruboss.collections.ModelsCollection;
<% end -%>
  import org.ruboss.models.RubossModel;
  
  [Resource(name="<%= resource_controller_name %>")]
  [Bindable]
  public class <%= class_name %> extends RubossModel {
<% if attributes && !attributes.empty? && attributes[0].flex_type != "Boolean" -%>
    public static const LABEL:String = "<%= attributes[0].flex_name %>";
<% else -%>
    public static const LABEL:String = "id";
<% end -%>

<% for attribute in attributes -%>
<% if attribute.type == :datetime || attribute.type == :time -%>
    [DateTime]
<% end -%>
    public var <%= attribute.flex_name %>:<%= attribute.flex_type %>;

<% end -%>
<% for model in belongs_tos -%>
    [BelongsTo]
    public var <%= model.camelcase(:lower) %>:<%= model.camelcase %>;

<% end -%>
<% for model in has_ones -%>
    [HasOne]
    public var <%= model.camelcase(:lower) %>:<%= model.camelcase %>;
    
<% end -%>
<% for model in has_manies -%>
    [HasMany]
    public var <%= model.camelcase(:lower) %>:ModelsCollection;
    
<% end -%>
    public function <%= class_name %>() {
      super(LABEL);
    }
  }
}

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
dima-ruboss4ruby-1.1.0 generators/ruboss_scaffold/templates/model.as.erb
dima-ruboss4ruby-1.1.0 rails_generators/ruboss_scaffold/templates/model.as.erb