Show Menu
Cheatography

ERB Snippets 2 Cheat Sheet (DRAFT) by

Snippets for when creating forms in Rails

This is a draft cheat sheet. It is a work in progress and is not finished yet.

lib/ac­tio­n_v­iew­/he­lpe­rs/­for­m_o­pti­ons­_he­lper.rb

d collection_select
  binding.pry
Then $ rails s (restart server)
f.collection_select
<select>
d select
  binding.pry
f.select
<select>
fassig­nee_id, fhow_h­eard, fstatus, ftrans­act­ion­_type
d time_zone_select
  binding.pry
f.time_zone_select
<select>
<option> X N
ftime_zone

lib/ac­tio­n_v­iew­/he­lpe­rs/­dat­e_h­elp­er.rb

def datetime_select
   bindin­g.pry
Then $ rails s (restart server)
f.datetime_select
<select>
fstarts_at
def time_select
   bindin­g.pry
f.time_select
<input> X 3
<select> X 2
fstarts_at

action­tex­t/a­pp/­hel­per­s/a­cti­on_­tex­t/t­ag_­hel­per.rb

def rich_text_area_tag
   bindin­g.pry
Then $ rails s (restart server)
f.rich_text_area_tag
fcontent

turbo-­rai­ls/­app­/he­lpe­rs/­tur­bo/­fra­mes­_he­lper.rb

def turbo_frame_tag
   bindin­g.pry
Then $ rails s (restart server)
f.turbo_frame_tag
<turbo-frame>

turbo-­rai­ls/­app­/he­lpe­rs/­tur­bo/­fra­mes­_he­lper.rb

def turbo_frame_tag
   bindin­g.pry
Then $ rails s (restart server)
f.turbo_frame_tag
<turbo-frame>