-
-
Save gordielachance/1238ebdb452e5f6fbd8cb2600bb7a851 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, i've got problems validating parameters sent to my API route. | |
puts "PARAMS" | |
puts params.to_json | |
=begin | |
{ | |
"url":"http://www.last.fm/user/grosbouff/loved", | |
"options":{ | |
"selectors":{ | |
"playlist":{ | |
"tracks":{ | |
"path":"table.chartlist tbody tr" | |
} | |
}, | |
"track":{ | |
"artist":{ | |
"path":"td.chartlist-name .chartlist-ellipsis-wrap .chartlist-artists a" | |
}, | |
"title":{ | |
"path":"td.chartlist-name .chartlist-ellipsis-wrap > a" | |
},"image":{ | |
"path":"img.cover-art","attr":"src" | |
} | |
} | |
} | |
} | |
} | |
=end | |
puts "REQUIRE" | |
puts params.require(:url) | |
#returns | |
#http://www.last.fm/user/grosbouff/love | |
puts "PERMIT" | |
puts params.permit(:options) | |
#returns | |
#Unpermitted parameters: :url, :options | |
#{} | |
#why is parmas.permit firing an error ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment