Skip to content

Commit 5ae8d86

Browse files
committed
fix redirect
1 parent 73aa664 commit 5ae8d86

File tree

6 files changed

+89
-64
lines changed

6 files changed

+89
-64
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ gem 'rails', '3.2.9.rc2'
44
gem 'state_machine'
55
gem 'jquery-rails'
66
gem 'pg'
7+
gem 'tconsole'
78

89
group :assets do
910
gem 'sass-rails', '~> 3.2.3'

Gemfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ GEM
5353
mime-types (~> 1.16)
5454
treetop (~> 1.4.8)
5555
mime-types (1.19)
56+
minitest (3.3.0)
5657
multi_json (1.3.7)
5758
pg (0.14.1)
5859
polyglot (0.3.3)
@@ -96,6 +97,10 @@ GEM
9697
rack (~> 1.0)
9798
tilt (~> 1.1, != 1.3.0)
9899
state_machine (1.1.2)
100+
tconsole (1.2.5)
101+
minitest (~> 3.3.0)
102+
term-ansicolor (~> 1.0.7)
103+
term-ansicolor (1.0.7)
99104
therubyracer (0.10.2)
100105
libv8 (~> 3.3.10)
101106
thor (0.16.0)
@@ -119,5 +124,6 @@ DEPENDENCIES
119124
sass-rails (~> 3.2.3)
120125
simplecov
121126
state_machine
127+
tconsole
122128
therubyracer
123129
uglifier (>= 1.0.3)

app/controllers/posts_controller.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ def edit
3939

4040
def change_state
4141
@post = Post.find(params[:post_id])
42-
@post.fire_state_event(params[:event])
43-
@post.save
44-
redirect_to post_path(params[:post_id])
42+
if @post
43+
@post.fire_state_event(params[:event])
44+
@post.save
45+
end
46+
redirect_to posts_path
4547
end
4648

4749
# POST /posts

coverage/.last_run.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"result": {
3-
"covered_percent": 95.96
3+
"covered_percent": 96.0
44
}
55
}

coverage/.resultset.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@
251251
0,
252252
0,
253253
null,
254+
0,
255+
null,
254256
null,
255257
null,
256258
null,
@@ -389,7 +391,7 @@
389391
null
390392
]
391393
},
392-
"timestamp": 1353001544
394+
"timestamp": 1353002271
393395
},
394396
"Functional Tests": {
395397
"coverage": {
@@ -638,6 +640,8 @@
638640
1,
639641
1,
640642
null,
643+
1,
644+
null,
641645
null,
642646
null,
643647
null,
@@ -770,6 +774,6 @@
770774
null
771775
]
772776
},
773-
"timestamp": 1353001550
777+
"timestamp": 1353002278
774778
}
775779
}

0 commit comments

Comments
 (0)