Skip to content

Instantly share code, notes, and snippets.

@megalithic
Created February 7, 2013 16:25
Show Gist options
  • Save megalithic/4732117 to your computer and use it in GitHub Desktop.
Save megalithic/4732117 to your computer and use it in GitHub Desktop.
i think we just need to wrap it in a document.ready basic.
$(function() {
$(".prep-select").html('<%= select_tag("recipe_ingredients[#{@recipe_ingredient.id}][prep_action_id]", options_from_collection_for_select(@preps, :id, :name, @recipe_ingredient.prep_action_id), {include_blank: true, prompt: 'Select Prep Action', class: 'chzn'}).gsub(/n/, '') %>');
$(".prep-select").append("<option value=''> Select a Prep Option </option>");
});
@rclements
Copy link

Started GET "/ingredient_pickers?utf8=%E2%9C%93&_method=put&authenticity_token=WB2vP2mGpj63Zp73qtiQmWtWI9mRX8ieutA2Aiwl7O0%3D&recipe_ingredients%5B7786591424262285875240%5D%5Bingredient_id%5D=INGREDIENT_2&recipe_ingredients%5B7786591424262285875240%5D%5Bprep_action_id%5D=&recipe_ingredients%5B7786591424262285875240%5D%5Bingredient_amount%5D=&recipe_ingredients%5B7786591424262285875240%5D%5Brecipe_step%5D=1&recipe_ingredients%5B1%5D%5Bingredient_id%5D=INGREDIENT_1&recipe_ingredients%5B1%5D%5Bprep_action_id%5D=1&recipe_ingredients%5B1%5D%5Bingredient_amount%5D=1&recipe_ingredients%5B1%5D%5Bmeasurement_unit_id%5D=1&recipe_ingredients%5B1%5D%5Brecipe_step%5D=1&recipe_ingredients%5B2%5D%5Bingredient_id%5D=INGREDIENT_2&recipe_ingredients%5B2%5D%5Bprep_action_id%5D=&recipe_ingredients%5B2%5D%5Bingredient_amount%5D=1&recipe_ingredients%5B2%5D%5Bmeasurement_unit_id%5D=1&recipe_ingredients%5B2%5D%5Brecipe_step%5D=2&recipe_ingredients%5B3%5D%5Bingredient_id%5D=RECIPE_1&recipe_ingredients%5B3%5D%5Bprep_action_id%5D=&recipe_ingredients%5B3%5D%5Bingredient_amount%5D=1&recipe_ingredients%5B3%5D%5Bmeasurement_unit_id%5D=1&recipe_ingredients%5B3%5D%5Brecipe_step%5D=3&step_notes%5B1%5D=&step_notes%5B2%5D=&step_notes%5B3%5D=" for 127.0.0.1 at 2013-02-07 10:33:57 -0600
Processing by IngredientPickersController#index as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"WB2vP2mGpj63Zp73qtiQmWtWI9mRX8ieutA2Aiwl7O0=", "recipe_ingredients"=>{"7786591424262285875240"=>{"ingredient_id"=>"INGREDIENT_2", "prep_action_id"=>"", "ingredient_amount"=>"", "recipe_step"=>"1"}, "1"=>{"ingredient_id"=>"INGREDIENT_1", "prep_action_id"=>"1", "ingredient_amount"=>"1", "measurement_unit_id"=>"1", "recipe_step"=>"1"}, "2"=>{"ingredient_id"=>"INGREDIENT_2", "prep_action_id"=>"", "ingredient_amount"=>"1", "measurement_unit_id"=>"1", "recipe_step"=>"2"}, "3"=>{"ingredient_id"=>"RECIPE_1", "prep_action_id"=>"", "ingredient_amount"=>"1", "measurement_unit_id"=>"1", "recipe_step"=>"3"}}, "step_notes"=>{"1"=>"", "2"=>"", "3"=>""}, "collection"=>[:ingredients]}
User Load (1.0ms) SELECT users.* FROM users WHERE users.id = 1 LIMIT 1
Ingredient Load (0.8ms) SELECT ingredients.* FROM ingredients
PrepAction Load (0.3ms) SELECT prep_actions.* FROM prep_actions
MeasurementUnit Load (0.2ms) SELECT measurement_units.* FROM measurement_units
Rendered ingredient_pickers/index.js.erb (2.2ms)
Completed 200 OK in 17ms (Views: 7.1ms | ActiveRecord: 2.3ms)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment