mardi 26 avril 2016

How to render json for more than one outer join tables with 'includes' option

i have a outer join active record. i need to display json for the outer join query. This is the active record i have written

@recent_details=Property.includes(:space_amenities,:event_suitabilities,:purpose_suitabilities,:venue_categories).where(id: params[:id]) respond_to do |format| format.json { render :json => @recent_details.to_json(include: :venue_categories)} end

here in json part, with include option i included only one outer join table. i need to include all these 4(:space_amenities,:event_suitabilities,:purpose_suitabilities,:venue_categories) tables in include option. how to include all these while rendering json.

Any help is appreiatable.

Aucun commentaire:

Enregistrer un commentaire