Sha256: 69871d262c49e2e44f80413f4fe09f456a805af95954f2f13a469fd0f219ddb1

Contents?: true

Size: 1.18 KB

Versions: 10

Compression:

Stored size: 1.18 KB

Contents

package <%= base_package %>.models {
<% if has_manies.length > 0 -%>
  import org.restfulx.collections.ModelsCollection;
<% end -%>
  import org.restfulx.models.RxModel;
  
  [Resource(name="<%= resource_controller_name %>")]
  [Bindable]
  public class <%= class_name %> extends RxModel {
<% 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 %> = <%= attribute.flex_default %>;

<% 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

10 entries across 6 versions & 2 rubygems

Version Path
dima-restfulx-1.2.0 generators/rx_scaffold/templates/model.as.erb
dima-restfulx-1.2.0 rails_generators/rx_scaffold/templates/model.as.erb
dima-restfulx-1.2.1 rails_generators/rx_scaffold/templates/model.as.erb
dima-restfulx-1.2.1 generators/rx_scaffold/templates/model.as.erb
dima-restfulx-1.2.2 rxgen_generators/rx_scaffold/templates/model.as.erb
restfulx-1.2.0 generators/rx_scaffold/templates/model.as.erb
restfulx-1.2.2 rxgen_generators/rx_scaffold/templates/model.as.erb
restfulx-1.2.1 rails_generators/rx_scaffold/templates/model.as.erb
restfulx-1.2.1 generators/rx_scaffold/templates/model.as.erb
restfulx-1.2.0 rails_generators/rx_scaffold/templates/model.as.erb