Rails / JBuilder - Entity array with has_many attributes
- by seufagner
I have two models, Person and Image and I want return an json array of Persons with your Images.
But I dont want return all Image attributes, but produces a different result.
Code below:
class Person < ActiveRecord::Base
has_many :images, as: :imageable
validates :name, presence: true
accepts_nested_attributes_for :images, :reject_if…