lib/dynamic_models.rb
def new_model(defaults = {})
    new_model = model_class.new(defaults)
    # if there is a parent then associate it with the model
    if parent_model
      new_model.send("#{parent_model.class.name.underscore}=", parent_model)
    end
    # return the new model
    new_model
  end
# returns a new model, it can be set with an optional hash
returns a new model, it can be set with an optional hash
returns a new model it can be set with an optional hash
def new_model(defaults = {})
    new_model = model_class.new(defaults)
    if parent_model
      new_model.send("#{parent_model.class.name.underscore}=", parent_model)
    end
    new_model
  end
def new_model ( defaults = { } ) new_model = model_class . new ( defaults ) if parent_model new_model . send ( "#{parent_model.class.name.underscore}=" , parent_model ) end new_model end
returns a new model, it can be set with an optional hash
returns a new model it can be set with an optional hash
# if there is a parent then associate it with the model # return the new model
defaults