lundi 24 décembre 2018

Convert id into string to use in url

I want to convert id into string to use in url

@tutorial_id = Demotutorial.where("job_id = ?", @job_id).select( "id")
@t_id = @tutorial_id.to_s
   render json: @t_id

Getting this error

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Tutorial Json array

{"demotutorials":[{"demotutorials":{"id":50}}]}

Aucun commentaire:

Enregistrer un commentaire