8 distance_of_time_in_words(Time.now, project.end_date) #=> 3 hours
9 distance_of_time_in_words_to_now(project.end_date) #=> 3 hours
11 time_ago_in_words 3.minutes.ago #=> "3 minutes"
15 number_to_currency 20.33
16 number_to_currency 20.33, precision: 0
17 number_with_precision 3.14159, precision: 2
18 number_to_percentage 32 #=> "32%"
19 number_with_delimiter 2048 #=> "2,048"
20 number_to_human 12000000 #=> "12 million"
21 number_to_human_size 12000000 #=> "12 MB"
22 number_to_phone "5551234" #=> "555-1234"
26 <% cache project do %>
27 <% cache [project, current_user] do %>
29 <% cache_if admin?, project do %>
30 <% cache_unless admin?, project do %>
35 tag("img", src: "image.jpg")
36 content_tag(:p, "Hello")
40 # Creates a time select tag that, when POSTed, will be stored in the article
41 # variable in the sunrise attribute.
42 time_select "article", "start_time"
44 # All options are optional
45 time_select "article", "start_time", \
46 include_seconds: true,
49 prompt: { hour: "Choose hr", minute: "Choose min", second: "Choose sec" },
52 # For dates (all options are optional)
53 date_select "article", "written_on", \
55 use_month_numbers: true,
58 order: [:day, :month, :year],
59 default: 3.days.from_now,
61 prompt: { day: 'Select day', month: 'Select month', year: 'Select year' }
66 #=> '<time datetime="2010-11-04">November 04, 2010<%rtime>'
69 #=> '<time datetime="2010-11-04T17:55:45+01:00">November 04, 2010 17:55</time>'
71 time_tag Date.yesterday, 'Yesterday'
72 #=> '<time datetime="2010-11-03">Yesterday<%rtime>'
74 time_tag Date.today, pubdate: true
75 #=> '<time datetime="2010-11-04" pubdate="pubdate">November 04, 2010</time>'
77 time_tag Date.today, \
78 format: :short_date # (en.time.formats.short_date)
82 = form_for @post, multipart: true do |f|
83 = f.file_field :picture
92 t('x_files', count: files.count)
95 # other: '%{count} files'
99 * http://api.rubyonrails.org/classes/ActionView/Helpers.html