Skip to content

Commit 5247980

Browse files
committed
Merge pull request railsbridge#135 from kerrizor/update-autogenerated-controller-code
update example code to reflect autogenerated controller code
2 parents 4c20f32 + f4dcfe6 commit 5247980

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

sites/curriculum/redirect_to_the_topics_list_after_creating_a_new_topic.step

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ steps {
1616

1717
message "Find the line:"
1818

19-
source_code :ruby, "format.html { redirect_to @topic, :notice => 'Topic was successfully created.' }"
19+
source_code :ruby, "format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }"
20+
2021

2122
message 'and change `@topic` to `topics_path` like this:'
2223

23-
source_code :ruby, "format.html { redirect_to topics_path, :notice => 'Topic was successfully created.' }"
24+
source_code :ruby, "format.html { redirect_to topics_path, notice: 'Topic was successfully created.' }"
2425

2526
message 'so that the file looks like this:'
2627

@@ -30,11 +31,11 @@ def create
3031

3132
respond_to do |format|
3233
if @topic.save
33-
format.html { redirect_to topics_path, :notice => 'Topic was successfully created.' }
34-
format.json { render :json => @topic, :status => :created, :location => @topic }
34+
format.html { redirect_to topics_path, notice: 'Topic was successfully created.' }
35+
format.json { render json: @topic, status: :created, location: @topic }
3536
else
36-
format.html { render :action => "new" }
37-
format.json { render :json => @topic.errors, :status => :unprocessable_entity }
37+
format.html { render action: "new" }
38+
format.json { render json: @topic.errors, status: :unprocessable_entity }
3839
end
3940
end
4041
end
@@ -62,10 +63,10 @@ end
6263
explanation {
6364

6465
message <<-MARKDOWN
65-
* `format.html { redirect_to topics_path, :notice => 'Topic was successfully created.' }`:
66+
* `format.html { redirect_to topics_path, notice: 'Topic was successfully created.' }`:
6667
* `format.html` means that the server should send html back to the browser
6768
* `redirect_to topics_path` means show the **topics list page** when we're done creating a topic
68-
* `:notice => 'Topic was successfully created.'` puts the message into the flash so it will be displayed on the topics list
69+
* `notice: 'Topic was successfully created.'` puts the message into the flash so it will be displayed on the topics list
6970
MARKDOWN
7071
}
7172

0 commit comments

Comments
 (0)