Skip to content

Instantly share code, notes, and snippets.

@SkyKOG
Created April 16, 2013 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SkyKOG/5394338 to your computer and use it in GitHub Desktop.
Save SkyKOG/5394338 to your computer and use it in GitHub Desktop.
redirect
class PerformaonesController < InheritedResources::Base
def new
@performaone = Performaone.new(:employee_id => params[:id], :hospital_id => params[:hospital_id])
end
def create
@performaone = Performaone.new(params[:performaone])
respond_to do |format|
if @performaone.save
format.html { redirect_to @performaone, notice: 'Performance Entry for the employee was successfully created.' }
format.json { render json: @performaone, status: :created, location: @performaone }
else
format.html { render action: "new" }
format.json { render json: @performaone.errors, status: :unprocessable_entity }
end
end
def index
@performaones = Performaone.order(:employee_id)
respond_to do |format|
format.html
format.csv { send_data @performaones.to_csv }
format.xls # { send_data @performaones.to_csv(col_sep: '\t') }
end
end
end
def delete
@performaone.destroy
redirect_to(new_performaone_path(:hospital_id => @performaone.hospital_id, :id => @performaone.id))
end
end
@SkyKOG
Copy link
Author

SkyKOG commented Apr 16, 2013

    def destroy

          @lo=Performaone.find(params[:id])
          @lol=@lo
          @lo.destroy
          respond_to do |format|
             format.html { redirect_to(new_performaone_path(:hospital_id => @lol.hospital_id, :id => @lol.employee_id)) }
             format.json { head :no_content }
          end
    end 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment