Created nice_title method in model:

 def nice_title title.titleize end 

How can I use it now in to_json(only: ...) ?

Just the title works, but nice_title simply ignored.

  • @ D-side I apologize for not answering for so long. Now I got to this site again. :methods also did not help. Nothing changed. - Colibri
  • @ D-side Lying :) Changed. :methods must be used separately from :only . :only is responsible for default table fields. - Colibri
  • Still got started? Leave a response then. - D-side

0