0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Railsで招待フォームを作成しよう1

Last updated at Posted at 2019-01-18

動画で説明した内容にそって、このフォームをRailsで作成していきたいと思います。
https://youtu.be/JaMzNhCxt_I

google_form.png

terminal
rails generate scaffold User name:string email:string sex:integer age:integer address:integer attendance:integer opinion:text
terminal
 vi app/models/user.rb
app/models/user.rb
class User < ApplicationRecord                                                                                                                                
  enum sex: { male: 0, female: 1 }
end
terminal
 vi app/views/users/_form.html.erb

Viewファイルを、radioボタンに変更

app/views/users/_form.html.erb
<%= form.label :sex %>
<%= form.radio_button :sex, 'male' %>男性
<%= form.radio_button :sex, 'female' %>女性
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?