Skip to content

Instantly share code, notes, and snippets.

@sameera207
Created October 13, 2014 02:40
Show Gist options
  • Save sameera207/a274243edbbe9c33090f to your computer and use it in GitHub Desktop.
Save sameera207/a274243edbbe9c33090f to your computer and use it in GitHub Desktop.
accept nested attributes with rails4 strong params
class ItemsController < ApplicationController
#rest of your methods
# ......
private
def item_params
params.require(:item).permit(
:name,
:content,
:image,
:address,
:country,
:country_code,
:user_id,
prices_attributes: [:price, :item_id, :user_id, :_destroy]
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment