[RAILS] I made a gender selection column with enum

Allows you to select gender when posting new

① Set the data type when using enum to gender: integer

② Describe enum gender: {man: 0, woman: 1} in the model

③ Create view

 <%= f.label :man %>
 <%= f.radio_button :gender, :man %>
 <%= f.label :woman %>
 <%= f.radio_button :gender, :woman %>

Completion: blush:

However, if this is the case, the view will say man or woman, so

I enum gender: {male: 0, female: 1}

 <%= f.label :Man%>
 <%= f.radio_button :gender, :Man%>
 <%= f.label :woman%>
 <%= f.radio_button :gender, :woman%>

I made it like that. I don't know if it's okay, but: sweat:

Should I use a gem that translates English into Japanese? ??

Recommended Posts

I made a gender selection column with enum
I made a GUI with Swing
I made a risky die with Ruby
I made a rock-paper-scissors app with kotlin
I made a rock-paper-scissors app with android
04. I made a front end with SpringBoot + Thymeleaf
I made a mosaic art with Pokemon images
[Rails] I made a draft function using enum
I made a LINE bot with Rails + heroku
I made a portfolio with Ruby On Rails
[Ruby] I made a crawler with anemone and nokogiri.
I made a chat app.
I made a development environment with rails6 + docker + postgreSQL + Materialize.
I made a plugin to execute jextract with Gradle task
I made a mod that instantly calls a vehicle with Minecraft
Ruby: I made a FizzBuzz program!
I made a shopify app @java
I made a simple recommendation function.
I made a matching app (Android app)
I made a package.xml generation tool.
[Android] I made a pedometer app.
I made a command line interface with WinMerge Plugin using JD-Core
[Rails] I made a simple calendar mini app with customized specifications.
I made a simple search form with Spring Boot + GitHub Search API.
[Ruby] I made a simple Ping client
I made an app to scribble with PencilKit on a PDF file
I made an eco server with scala
I tried playing with BottomNavigationView a little ①
I made a plugin for IntelliJ IDEA
I made a calculator app on Android
I made a new Java deployment tool
[LINE BOT] I made a ramen BOT with Java (Maven) + Heroku + Spring Boot (1)
I made a bulletin board using Docker 1
I made a site that summarizes information on carbohydrate restriction with Vue.js
Learn Java with Progate → I will explain because I made a basic game myself
I made a Diff tool for Java files
I made a primality test program in Java
I made blackjack with Ruby (I tried using minitest)
I made a rock-paper-scissors game in Java (CLI)
I made a viewer app that displays a PDF
I made a Docker container to run Maven
I made a Ruby extension library in C
I built a Code Pipeline with AWS CDK.
I tried to break a block with java (1)
I tried deploying a page made with antique Middleman on Azure Static Web Apps
I made a lock pattern using the volume key with the Android app. Fragment edition
I made a function to register images with API in Spring Framework. Part 1 (API edition)
I made a Docker image of SDAPS for Japanese
I made a simple calculation problem game in Java
I made an iPhone Theremin with Vision framework + AudioKit
A simple CRUD app made with Nuxt / Laravel (Docker)
I made a check tool for the release module
I made a method to ask for Premium Friday
I made a drawing chat "8bit paint chat" on WebAssembly
I want to monitor a specific file with WatchService
I made a Restful server and client in Spring.
Quickly implement a singleton with an enum in Java
I made a library that works like a Safari tab !!
I tried OCR processing a PDF file with Java
[Beginner] I stumbled upon launching a project with Rails6
I made a library for displaying tutorials on Android.