Redirect update back to list, safely view habit name

This commit is contained in:
Tyler Renelle 2012-02-01 19:41:22 +00:00
parent 523a207555
commit 588ad0c900
2 changed files with 2 additions and 2 deletions

View file

@ -56,7 +56,7 @@ class HabitsController < ApplicationController
respond_to do |format|
if @habit.update_attributes(params[:habit])
format.html { redirect_to @habit, notice: 'Habit was successfully updated.' }
format.html { redirect_to habits_url, notice: 'Habit was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }

View file

@ -9,7 +9,7 @@
when s>=5 && s<15 then score = 'good'
when s>=15 then score = 'done'
end
name = "<span class='#{score}'>#{habit.name}</span>"
name = "<span class='#{score}'>#{h(habit.name)}</span>"
%>