Same as ActiveModel::model but allows you to define the main model in the composition
 using +:on+.

 class CoverSongForm < Reform::Form
   model :song, on: :cover_song
1717
def model(main_model, options={})
      super

      composition_model = options[:on] || main_model

      # FIXME: this should just delegate to :model as in FB, and the comp would take care of it internally.
      [:persisted?, :to_key, :to_param].each do |method|
        define_method method do
          model[composition_model].send(method)
        end
      end

      self
    end
474635
def describe(shallow = true, example: nil)
      description = {}
      # Clone the common options
      TOP_LEVEL_OPTIONS.each do |option_name|
        description[option_name] = options[option_name] if options.key? option_name
      end

      # Make sure this option definition is not mistaken for the real generated example
      if (ex_def = description.delete(:example))
        description[:example_definition] = ex_def
      end

      special_options = options.keys - TOP_LEVEL_OPTIONS - INTERNAL_OPTIONS
      description[:options] = {} unless special_options.empty?
      special_options.each do |opt_name|
        description[:options][opt_name] = options[opt_name]
      end
      # Change the reference option to the actual class name.
      if (reference = options[:reference])
        description[:options][:reference] = reference.name
      end

      description[:type] = type.describe(shallow, example: example)
      # Move over any example from the type, into the attribute itself
      if (ex = description[:type].delete(:example))
        description[:example] = dump(ex)
      end

      description
    end
992840
function Model(options) {
    this._document = options.document;
    options.document = options.document || {};
    this._handler = options.handler;
    this._id = options._id || options.document._id;
    this.name = options.name || options.document.name;
    this.layers = options.layers || options.document.layers;
    this.epochs = options.epochs || options.document.epochs;
    this.error = options.error || options.document.error;

    if (!(this._id instanceof ObjectID)) {
        this._id = new ObjectID(this._id);
    }

    if (!Array.isArray(this.layers) || this.layers.length < 3) {
        throw new Error('Layers array attribute needs to be at least 3');
    }

    this.filename = __dirname + '/neuralNetwork/' + this.name + '.nnet';
    if (fs.existsSync(this.filename)) {
        this.neuralNetwork = new fann.load(this.filename);
    }
}
799999
def item_params
      model = @item.class.name.split('::').last.underscore
      params.require(:"#{model}").permit!
    end
1182651
def to_model
      pcs = @preconditions.collect(&:to_model)
      mr = @reference ? @reference.to_model : nil
      cc = @conjunction
      HQMF::Precondition.new(@id, pcs, mr, cc, @negation)
    end
1259103
def model_name
      if defined?(ActiveSupport::ModelName)
        ActiveSupport::ModelName.new(name)
      else
        ActiveModel::Name.new(self)
      end
    end
985294
def model
      @model ||= begin
        model = find_or_build_model

        set_attributes(model)

        after_build_blocks.each { |block| instance_exec(model, &block) }
        model
      end
    end
361438
function(model, options) {
            options || (options = {});
            if (!(model instanceof Model)) {
                var attrs = model;
                options.collection = this;
                model = new this.model(options, attrs);
            } else if (!model.collection) {
                model.collection = this;
            }
            return model;
        }
828128
def map_to(klass, **opts)
      with(opts.merge(auto_map: false, auto_struct: true, meta: { model: klass }))
    end
1092959
function Model(name, config) {
	this.name = name;

	utils.defaultsDeep(config, {
		attributes: {},
		sharedMethods: {},
		clientMethods: {},
		serverMethods: {},
		hooks: {},
		options: {
			allowREST: true,
			middlewares: [],
			generateClientModel: true,
			hooks: {}
		},
		relationships: {}
	});

	//Copy all configs to the model object
	for(var c in config) {
		if(config.hasOwnProperty(c)) {
			this[c] = config[c];
		}
	}

	return this;
}
318904
def generate_form(model, only=None, meta=None):
    
    fields = OrderedDict()
    if meta:
        fields['Meta'] = meta

    for name, column in model.__dict__['columns'].items():
        if only:
            if not name in only:
                continue
        if not isinstance(column, Column):
            continue
        fields[name] = TYPE_MAP[column.type.__class__](
            name, render_kw={'placeholder': name}
        )
    form = type(
        'Add{}Form'.format(model.name.capitalize()),
        (Form,),
        fields
    )
    return form
906537
function UMLAttribute() {
        UMLStructuralFeature.apply(this, arguments);

        /** @member {string} */
        this.isDerived = false;

        /** @member {string} */
        this.aggregation = AK_NONE;

        /** @member {boolean} */
        this.isID = false;
    }
1178120
def markdown_composer(method, options = {})
      render(partial:"admin/shared/forms/markdown_composer", locals: {
        f: self,
        method: method,
        options: options,
      })
    end
1095472
def model(model_names):
    
    # for each model name we need to create
    for model_name in model_names:
        # the template context
        context = {
            'name': model_name,
        }

        # render the model template
        render_template(template='common', context=context)
        render_template(template='model', context=context)
419575
def serialize_model(model):
    

    result = ''

    # First serialize the macros
    for macro in model['macros']:
        if macro.get('options', None):
            result += '~o '
            for option in macro['options']['definition']:
                result += _serialize_option(option)

        elif macro.get('transition', None):
            result += '~t "{}"\n'.format(macro['transition']['name'])
            result += _serialize_transp(macro['transition']['definition'])

        elif macro.get('variance', None):
            result += '~v "{}"\n'.format(macro['variance']['name'])
            result += _serialize_variance(macro['variance']['definition'])

        elif macro.get('state', None):
            result += '~s "{}"\n'.format(macro['state']['name'])
            result += _serialize_stateinfo(macro['state']['definition'])

        elif macro.get('mean', None):
            result += '~u "{}"\n'.format(macro['mean']['name'])
            result += _serialize_mean(macro['mean']['definition'])

        elif macro.get('duration', None):
            result += '~d "{}"\n'.format(macro['duration']['name'])
            result += _serialize_duration(macro['duration']['definition'])

        else:
            raise NotImplementedError('Cannot serialize {}'.format(macro))

    for hmm in model['hmms']:
        if hmm.get('name', None) is not None:
            result += '~h "{}"\n'.format(hmm['name'])

        result += _serialize_hmm(hmm['definition'])

    return result
646381
function(model, options) {
      var coll = this;
      options || (options = {});
      model = this._prepareModel(model, options);
      if (!model) return false;
      var success = options.success;
      options.success = function(nextModel, resp, xhr) {
        coll.add(nextModel, options);
        if (success) success(nextModel, resp, xhr);
      };
      model.save(null, options);
      return model;
    }
600560
def generate
      Dir["app/models/*.rb"].each do |path|
        result = File.basename(path).scan(/^(.+)\.rb/)[0][0]
        model = eval(ActiveSupport::Inflector.camelize(result))
        next if model.respond_to?(:abstract_class) && model.abstract_class
        next unless model < ActiveRecord::Base
        @annotations[model] = generate_annotation(model) unless @annotations.keys.include?(model)
      end
    end