[RUBY] About the matter that hidden_field can be used insanely

When do you use hidden_field? ??

For example, with a flea market app like Mercari, you need to create a column and give it an id in advance so that you can judge whether the product is in stock or sold out.

Let's assume that the inventory management column is used as the situation column, and id = 1 is assigned when the product is listed, and id = 0 is assigned when the product is sold out.

This hidden_field is useful when you want to give a specific id in advance at the time of registration.

Very easy to use! !!

Just add the following description to the form!


= f.hidden_field :situation, value: "1" #By specifying 1 in value, id when listing the item=1 is given

that's all

Recommended Posts

About the matter that hidden_field can be used insanely
About the range and scope where Day16 variables can be used
[Ruby] Methods that can be used with strings
About the case that ("b" .. "aa") could not be used in Ruby Range
Convenient shortcut keys that can be used in Eclipse
The story that the port can no longer be used in the Spring boot sample program
Summary of css selectors that can be used with Nookogiri
Create a page control that can be used with RecyclerView
The case that @Autowired could not be used in JUnit5
Firebase-Realtime Database on Android that can be used with copy
Four-in-a-row with gravity that can be played on the console
[Question] Can nullif be used in the count function in JPQL?
Introduction to Rakefile that can be done in about 10 minutes
Ruby on Rails 5 quick learning practice guide that can be used in the field Summary
Learning Ruby with AtCoder Beginners Selection [Some Sums] Increase the methods that can be used
Static analysis tool that can be used on GitHub [Java version]
About the language to be learned
Summary of ORM "uroboroSQL" that can be used in enterprise Java
I made a question that can be used for a technical interview
Power skills that can be used quickly at any time --Reflection
SwiftUI View that can be used in combination with other frameworks
About the matter that I was addicted to how to use hashmap
About the matter that tends to be confused with ARG of Dockerfile which is a multi-stage build
[Spring Boot] List of validation rules that can be used in the property file for error messages
Set the access load that can be changed graphically with JMeter (Part 2)
Simple slot machine implementation that can be used with copy and paste
Set the access load that can be changed graphically with JMeter (Part 1)
Performance analysis and failure diagnostic tools that can be used with OpenJDK
Ruby array methods that can be used with Rails (other than each)
Until ruby can be used on windows ...
Initial settings until S2Dao can be used
Object-oriented that can be understood by fairies
[ERROR message display] A simplified version that can be used at any time with the rails partial template.
[Android] I want to create a ViewPager that can be used for tutorials
Technology excerpt that can be used for creating EC sites in Java training
I made a THETA API client that can be used for plug-in development
About the matter that was confused by "param is missing or the value is empty:".
Try to save the data that can be read by JavaFX as PNG
A story about making a Builder that inherits the Builder
A description that only the poster can access
About the daylight saving time that really happened
[Android Studio] About the matter that the design view is not displayed when using TextClock