Sha256: 9ca4726c8fd4e9984b6d04436d93a85a7b9c6c3170346ef9e0fd4290e553ec1a

Contents?: true

Size: 1.45 KB

Versions: 22

Compression:

Stored size: 1.45 KB

Contents

package <%= base_package %>.controllers {
  import <%= base_package %>.models.*;
  import <%= base_package %>.commands.*;

	import mx.core.Application;		
  import org.restfulx.Rx;
  import org.restfulx.controllers.RxApplicationController;
  import org.restfulx.utils.RxUtils;

  public class <%= command_controller_name %> extends RxApplicationController {
    private static var controller:<%= command_controller_name %>;
    
    public static var models:Array = [<%= model_names %>]; /* Models */
    
    public static var commands:Array = [<%= command_names %>]; /* Commands */
    
    public function <%= command_controller_name %>(enforcer:SingletonEnforcer, 
      extraServices:Array, defaultServiceId:int = -1) {
      super(commands, models, extraServices, defaultServiceId);
    }
    
    public static function get instance():<%= command_controller_name %> {
      if (controller == null) initialize();
      return controller;
    }
    
    public static function initialize(extraServices:Array = null, 
      defaultServiceId:int = -1, airDatabaseName:String = null):void {
      if (!RxUtils.isEmpty(airDatabaseName)) Rx.airDatabaseName = airDatabaseName;
      controller = new <%= command_controller_name %>(new SingletonEnforcer, 
        extraServices, defaultServiceId);
			Rx.sessionToken = Application.application.parameters.session_token;
			Rx.authenticityToken = Application.application.parameters.authenticity_token;
    }
  }
}

class SingletonEnforcer {}

Version data entries

22 entries across 11 versions & 4 rubygems

Version Path
restfulx-1.2.2 rxgen_generators/rx_controller/templates/controller.as.erb
restfulx-1.2.2 rails_generators/rx_controller/templates/controller.as.erb