text_field(:variable, :attribute, options) hidden_field(:variable, :attribute, options) password_field(:variable, :attribute, options) เป็น tag ของการ input โดยแบ่งเป็นประเภทได้แก่ text, hidden, password โดยทั่วไปในโครงสร้างของการเขียน syntax ของ rails เพื่ออ้างอิงใช้งาน object นั้นสามารถเขียนได้ดังนี้ @variable.attribute Options ทั่วไปของ Text Fields :size => xx :maxsize => xx
text_area(:variable, :attribute, options) Options ทั่วไปของ Text Areas :rows => xx :cols => xx
check_box(:variable, :attribute, options, on_value, : off_value) การสร้าง checkbox ถูก checked จะทำให้ attribute จะมีค่าเป็น true โดย Default ค่าของ attribute มีเป็น 1 ในกรณีที่ checkbox ถูก checked นอกนั้น attribute จะมีค่าเป็น 0
date_select(:variable, :attribute, options)
datetime_select(:variable, :attribute, options)
select_date(date = Date.today, options)
select_day(date, options)
select_month(date, options)
select_year(date, options)
select_datetime(date = Time.now, options)
select_hour(time, options)
select_minute(time, options)
select_second(time, options)
select_time(time, options)
options
Time.now แสดง เวลาปัจจุบัน
:field_name => "time_end_minute" ตั้งชื่อ attribute name ชื่อ "time_end_minute"
:minute_step => 30 แสดงเวลาครั้งละ 30 นาที มี options สามารถเลือกได้คือ 0, 15, 30, 45
:add_month_numbers => ture แสดง เดือนเป็นวตัวเลข
:use_month_numbers => ture
:discard_month => true ตัดฟังก์ชัน month ออกจาก object
:discard_day => true ตัดฟังก์ชัน day ออกจาก object
:discard_hour => true ตัดฟังก์ชัน hour ออกจาก object
:discard_minute => true ตัดฟังก์ชัน minute ออกจาก object
:discard_second => true ตัดฟังก์ชัน second ออกจาก object
:order => [:day, : month, :year] เรียง object ตามที่กำหนด
โดย default จะแสดง year ก่อนและหลัง 5 ปี ถ้าจะกำหนดปีเอง สามารถกำหนด
:start_year => yyyy กำหนดปีเริ่มต้น
:end_year => yyyy กำหนดปีสิ้นสุด
สามารถ เขียนได้ 2 แบบ
1. date_select("reservation", "date_reserved")
2. date_select(:reservation, :date_reserved)