Skip to content

Instantly share code, notes, and snippets.

@abrambailey
Created April 8, 2012 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abrambailey/2336104 to your computer and use it in GitHub Desktop.
Save abrambailey/2336104 to your computer and use it in GitHub Desktop.
none
@brand1 = params[:brand][:name]
@model = params[:brand][:models_attributes]["0"]["name"]
@submodel = params[:brand][:models_attributes]["0"]["submodels_attributes"]["0"]["name"]
@style = params[:brand][:models_attributes]["0"]["submodels_attributes"]["0"]["styles_attributes"]["0"]["name"]
a = Brand.find_or_create_by_name(@brand1)
b = Model.find_or_create_by_name(@model, :brand_id => a.id)
c = Submodel.find_or_create_by_name(@submodel, :model_id => b.id)
d = Style.new(:name => @style, :submodel_id => c.id)
d.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment