class ChildResourcesController < ApplicationController # GET /child_resources # GET /child_resources.json def index @child_resources = ChildResource.all respond_to do |format| format.html # index.html.erb format.json { render json: @child_resources } end end # GET /child_resources/1 # GET /child_resources/1.json def show @child_resource = ChildResource.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @child_resource } end end # GET /child_resources/new # GET /child_resources/new.json def new @child_resource = ChildResource.new respond_to do |format| format.html # new.html.erb format.json { render json: @child_resource } end end # GET /child_resources/1/edit def edit @child_resource = ChildResource.find(params[:id]) end # POST /child_resources # POST /child_resources.json def create @child_resource = ChildResource.new(params[:child_resource]) respond_to do |format| if @child_resource.save format.html { redirect_to @child_resource, notice: 'Child resource was successfully created.' } format.json { render json: @child_resource, status: :created, location: @child_resource } else format.html { render action: "new" } format.json { render json: @child_resource.errors, status: :unprocessable_entity } end end end # PUT /child_resources/1 # PUT /child_resources/1.json def update @child_resource = ChildResource.find(params[:id]) respond_to do |format| if @child_resource.update_attributes(params[:child_resource]) format.html { redirect_to @child_resource, notice: 'Child resource was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @child_resource.errors, status: :unprocessable_entity } end end end # DELETE /child_resources/1 # DELETE /child_resources/1.json def destroy @child_resource = ChildResource.find(params[:id]) @child_resource.destroy respond_to do |format| format.html { redirect_to child_resources_url } format.json { head :no_content } end end end