avatar

26

if we just created a new exercise for today, redirect to today's workout instead

by chrisk, 19 Jun, 2007 07:10 PM
22 26  
4848     respond_to do |format|
4949       if @exercise.save
5050         flash[:notice] = 'Exercise was successfully created.'
51         format.html { redirect_to activity_path(@exercise.activity) }
51         format.html {
52           if @exercise.created_at.to_date == Time.now.to_date
53             redirect_to :controller => 'workouts', :action => 'today'
54           else
55             redirect_to activity_path(@exercise.activity)
56           end
57         }
5258         format.xml  { render :xml => @exercise, :status => :created, :location => exercise_path(@exercise.activity, @exercise) }
5359       else
5460         format.html { render :action => "new" }