if we just created a new exercise for today, redirect to today's workout instead
| 22 | 26 | |
|---|---|---|
| 48 | 48 | respond_to do |format| |
| 49 | 49 | if @exercise.save |
| 50 | 50 | 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 | } | |
| 52 | 58 | format.xml { render :xml => @exercise, :status => :created, :location => exercise_path(@exercise.activity, @exercise) } |
| 53 | 59 | else |
| 54 | 60 | format.html { render :action => "new" } |
