class Public::NeedsController < ApplicationController layout "public" before_filter :auth_customer def new @need = Need.new() end def destroy @need = Need.find(params[:id]) if(@need.destroy) flash[:notice] = "Besoin supprimé avec succès." end redirect_to public_my_account_path end def edit @need = Need.find(params[:id]) end def update @need = Need.find(params[:id]) if @need.update_attributes(need_params) flash[:notice] = "Besoin sauvegardé avec succès." redirect_to public_my_account_path else render :action => "edit" end end def create @need = Need.new(need_params) @need.author = current_customer if @need.save flash[:notice] = "Votre besoin à été créé avec succès." redirect_to public_my_account_path else render :action => "new" end end def need_params params.require(:need).permit(:title, :description) end end