質問編集履歴

2

elseとend の横にエラー分らしきものがでています

2021/10/10 06:54

投稿

uruman
uruman

スコア12

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- ### 前提・実現したいこと
1
+ ![イメージ説明](5c31d8f7257f91facfcdf9c44ccd6556.png)### 前提・実現したいこと
2
2
 
3
3
 
4
4
 

1

変更前のコード追加させていただきました

2021/10/10 06:54

投稿

uruman
uruman

スコア12

test CHANGED
File without changes
test CHANGED
@@ -23,6 +23,66 @@
23
23
  /home/ec2-user/environment/bookers/app/views/books/edit.html.erb:31: syntax error, unexpected ensure, expecting end-of-input ensure ^~~~~~
24
24
 
25
25
 
26
+
27
+ ```
28
+
29
+
30
+
31
+ ###エラー前のコード
32
+
33
+ ```contllore
34
+
35
+ def update
36
+
37
+ book = Book.find(params[:id])
38
+
39
+ book.update(book_params)
40
+
41
+ redirect_to book_path(book.id)
42
+
43
+ flash[:notice] = "Book was successfully updated."
44
+
45
+ end
46
+
47
+ ```
48
+
49
+ ```edit
50
+
51
+ <h1>Editing Book</h1>
52
+
53
+ <%=form_with model:@book,url:"/books/#{@book.id}",locla:true do |f| %>
54
+
55
+ <div class = "field">
56
+
57
+ <label for = "book_title">Title</label>
58
+
59
+ <%=f.text_field:title %>
60
+
61
+ </div>
62
+
63
+
64
+
65
+ <div class = "field">
66
+
67
+ <label for = "book_body">Body</label>
68
+
69
+ <%=f.text_area:body%>
70
+
71
+ </div>
72
+
73
+ <div class = "actions">
74
+
75
+ <%=f.submit'Update Book'%>
76
+
77
+ </div>
78
+
79
+ <%end%>
80
+
81
+ <%=link_to "Show",book_path(@book.id)%>
82
+
83
+ |
84
+
85
+ <%=link_to"Back",books_path(@book.id)%>
26
86
 
27
87
  ```
28
88