class <%= goal.cp %>Controller < ApplicationController before_filter :find_<%= goal.s %>, :only => [:show, :destroy, :edit, :update] before_filter :find_<%= goal.p %>, :only => :index before_filter :new_<%= goal.s %>, :only => [:new, :create] <%= generator.setup_enclosing_resources_method(goal) %> <%= generator.find_object_method(goal) %> <%= generator.find_collection_method(goal) %> <%= generator.new_object_method(goal) %> # GET /<%= goal.p %> # GET /<%= goal.p %>.xml def index respond_to do |format| format.html # index.html.erb format.xml { render :xml => @<%= goal.p %> } end end # GET /<%= goal.p %>/1 # GET /<%= goal.p %>/1.xml def show respond_to do |format| format.html # show.html.erb format.xml { render :xml => @<%= goal.s %> } end end # GET /<%= goal.p %>/new # GET /<%= goal.p %>/new.xml def new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @<%= goal.s %> } end end # GET /<%= goal.p %>/1/edit def edit end # POST /<%= goal.p %> # POST /<%= goal.p %>.xml def create respond_to do |format| if @<%= goal.s %>.save flash[:notice] = '<%= goal.cs %> was successfully created.' format.html { redirect_to(<%= generator.collection_path(goal) %>) } format.xml { render :xml => @<%= goal.s %>, :status => :created, :location => @<%= goal.s %> } else format.html { render :action => "new" } format.xml { render :xml => @<%= goal.s %>.errors, :status => :unprocessable_entity } end end end # PUT /<%= goal.p %>/1 # PUT /<%= goal.p %>/1.xml def update respond_to do |format| if @<%= goal.s %>.update_attributes(params[:<%= goal.s %>]) flash[:notice] = '<%= goal.cs %> was successfully updated.' format.html { redirect_to(<%= generator.object_path(goal) %>) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @<%= goal.s %>.errors, :status => :unprocessable_entity } end end end # DELETE /<%= goal.p %>/1 # DELETE /<%= goal.p %>/1.xml def destroy @<%= goal.s %>.destroy flash[:notice] = '<%= goal.cs %> was successfully removed.' respond_to do |format| format.html { redirect_to(<%= generator.collection_path(goal) %>) } format.xml { head :ok } end end end