jeudi 20 août 2015

How to send attr_accessor values in json render using ruby?

In my ruby on rails program i have used attr_accessor. But while rendering json its not coming in the view. My code is as follows

  @users.each do |user|
    user.entry_id= "QWER1234"
    user.save
  end
  respond_to do |format|
   format.html
   format.json { render json: {logs: @users, iTotalRecords: @users.total_entries, iTotalDisplayRecords: @users.total_entries} }
  end

If i check in view my attr_accessor entry_is is not available. Kindly help me to solve this issue.

Aucun commentaire:

Enregistrer un commentaire