i try to post my json to rails server with this request body
{"post":{
"user_id": 2,
"title": "kehangatan di pagi hari",
"category": "kehangatan di pagi hari",
"imageposts": [{"imageurl":"DJAWHDAHWDKJHAW DHJAWDHAWDAWDAD"}],
"description":"<p>memang sange</p>"
} }
and this is my posts_params
def post_params
params.require(:post).permit(:title, :user_id, :description, :category, :imageposts => [:imageurl])
end
unfortunately when i make an ajax post i got an error in my terminal
#<ActiveRecord::AssociationTypeMismatch: Imagepost(#42287660) expected, got ActiveSupport::HashWithIndifferentAccess(#30074960)>
i've trying this to my imageposts strong parameter but it doesnt work too
imageposts: [:imageurl]
can anybody solve this...
params
(See server log) – Gokul M Jul 26 '17 at 5:52