Rails Render Json

Is there something wrong with this?

  render :json => { :result => 'success', :profile_pic_path => @user.profile_pic.url(:large) }

Do I need to code or something like that. I get a random error from time to time, and I think it should be this line.

thank

+3
source share
1 answer

You need to add to_json

@your_array = { :result => 'success', :profile_pic_path => @user.profile_pic.url(:large) }

render :json => @your_array.to_json
-1
source

Source: https://habr.com/ru/post/1780560/


All Articles