I'm trying to remove an attribute from params before to update an object, but i don't succeed to do it.
Params contain an object Post, and i want to remove image_url from it :
{
"post" : "{
\"content\" : \"dfsgdfa\",
\"created_at\" : \"2013-09-01T08:39:26Z\",
\"id\" : 21,
\"image_content_type\" : \"image/jpeg\",
\"image_file_name\" : \"img.jpg\",
\"image_file_size\" : 61140,
\"image_updated_at\" : \"2013-09-01T08:39:26Z\",
\"title\" : \"sdsdsdd\",
\"updated_at\" : \"2013-09-01T08:39:26Z\",
\"user_id\" : 4,
\"image_url\" : \"/system/posts/images/000/000/021/original/img.jpg?137802476
\"}",
"image" : "null",
"action" : "update",
"controller" : "posts",
"id" : "21"
}
So i did like that :
params[:post].delete("image_url")
No errors are raised, but image_url is still in params[:post]
How can i delete it ?
params[:post]
is actually string in your case. It's not a hash. That's why it is not working.