質問編集履歴

2

viewの追加

2023/01/16 12:40

投稿

mameta00
mameta00

スコア1

test CHANGED
File without changes
test CHANGED
@@ -47,3 +47,35 @@
47
47
  end
48
48
  ```
49
49
 
50
+ app/views/products/new.html.erb
51
+ ```ruby
52
+ <% content_for(:title, t('.title')) %>
53
+ <div class="container">
54
+ <div class="row">
55
+ <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
56
+ <h1><%= t('.title') %></h1>
57
+ <%= form_with model: @product, local: true do |f| %>
58
+ <%= render 'layouts/error_messages', model: f.object %>
59
+ <div class="form-group">
60
+ <%= f.label :product_name %>
61
+ <%= f.text_field :product_name, class: 'form-control' %>
62
+ </div>
63
+ <div class="form-group">
64
+ <%= f.label :store_name %>
65
+ <%= f.text_field :store_name, class: 'form-control' %>
66
+ </div>
67
+ <div class="form-group">
68
+ <%= f.label :regular_price %>
69
+ <%= f.text_field :regular_price, class: 'form-control' %>
70
+ </div>
71
+ <div class="form-group">
72
+ <%= f.label :discounted_price %>
73
+ <%= f.text_field :discounted_price, class: 'form-control' %>
74
+ </div>
75
+ <%= f.submit t('defaults.signup'), class: 'btn btn-primary' %>
76
+ <% end %>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ ```
81
+

1

タイトル変更

2023/01/16 04:03

投稿

mameta00
mameta00

スコア1

test CHANGED
@@ -1 +1 @@
1
- [Rails] 1対多のテーブルからデータを取得する
1
+ [Rails] 対多のテーブルからデータを取得する
test CHANGED
File without changes