Right now I have this line:
render json: @programs, :except => [:created_at, :updated_at]
However, since a Program belongs_to a Company I would like to show the Company name instead of the Company Id.
在呈现程序时,如何包含公司名称?
Right now I have this line:
render json: @programs, :except => [:created_at, :updated_at]
However, since a Program belongs_to a Company I would like to show the Company name instead of the Company Id.
在呈现程序时,如何包含公司名称?
像这样的东西应该能行得通:
render :json => @programs, :include => {:insurer => {:only => :name}}, :except => [:created_at, :updated_at]