number_to_percentage

number_to_percentage(number, options = {}) Instance Public methods Formats a number as a percentage string (e.g., 65%). You can customize the format in the options hash. Options :locale - Sets the locale to be used for formatting (defaults to current locale). :precision - Sets the precision of the number (defaults to 3). :significant - If true, precision will be the # of significant_digits. If false, the # of fractional digits (defaults to false). :separator - Sets the separ

number_to_phone

number_to_phone(number, options = {}) Instance Public methods Formats a number into a US phone number (e.g., (555) 123-9876). You can customize the format in the options hash. Options :area_code - Adds parentheses around the area code. :delimiter - Specifies the delimiter to use (defaults to â-â). :extension - Specifies an extension to add to the end of the generated number. :country_code - Sets the country code for the phone number. :raise - If true, raises InvalidNumberE

number_with_delimiter

number_with_delimiter(number, options = {}) Instance Public methods Formats a number with grouped thousands using delimiter (e.g., 12,324). You can customize the format in the options hash. Options :locale - Sets the locale to be used for formatting (defaults to current locale). :delimiter - Sets the thousands delimiter (defaults to â,â). :separator - Sets the separator between the fractional and integer digits (defaults to â.â). :raise - If true, raises InvalidNumberError w

number_with_precision

number_with_precision(number, options = {}) Instance Public methods Formats a number with the specified level of :precision (e.g., 112.32 has a precision of 2 if :significant is false, and 5 if :significant is true). You can customize the format in the options hash. Options :locale - Sets the locale to be used for formatting (defaults to current locale). :precision - Sets the precision of the number (defaults to 3). :significant - If true, precision will be the # of significan

raw

raw(stringish) Instance Public methods This method outputs without escaping a string. Since escaping tags is now default, this can be used when you don't want Rails to automatically escape tags. This is not recommended if the data is coming from the user's input. For example: raw @user.name # => 'Jimmy <alert>Tables</alert>'

safe_join

safe_join(array, sep=$,) Instance Public methods This method returns a html safe string similar to what Array#join would return. All items in the array, including the supplied separator, are html escaped unless they are html safe, and the returned string is marked as html safe. safe_join(["<p>foo</p>".html_safe, "<p>bar</p>"], "<br />") # => "<p>foo</p>&lt;br /&gt;&lt;p&gt;bar&lt;/p&gt;" safe_join(["<p>foo&

content_tag_for

content_tag_for(tag_name, single_or_multiple_records, prefix = nil, options = nil, &block) Instance Public methods #content_tag_for creates an HTML element with id and class parameters that relate to the specified Active Record object. For example: <%= content_tag_for(:tr, @person) do %> <td><%= @person.first_name %></td> <td><%= @person.last_name %></td> <% end %> would produce the following HTML (assuming @person is an insta

div_for

div_for(record, *args, &block) Instance Public methods Produces a wrapper DIV element with id and class parameters that relate to the specified Active Record object. Usage example: <%= div_for(@person, class: "foo") do %> <%= @person.name %> <% end %> produces: <div id="person_123" class="person foo"> Joe Bloggs </div> You can also pass an array of Active Record objects, which will then get iterated over and yield each record as an argument for

_layout_for

_layout_for(*args, &block) Instance Public methods Overwrites #_layout_for in the context object so it supports the case a block is passed to a partial. Returns the contents that are yielded to a layout, given a name or a block. You can think of a layout as a method that is called with a block. If the user calls yield :some_name, the block, by default, returns content_for(:some_name). If the user calls simply yield, the default block returns content_for(:layout). The user can o

render

render(options = {}, locals = {}, &block) Instance Public methods Returns the result of a render that's dictated by the options hash. The primary options are: :partial - See ActionView::PartialRenderer. :file - Renders an explicit template file (this used to be the old default), add :locals to pass in those. :inline - Renders an inline template similar to how it's done in the controller. :text - Renders the text passed in out. :plain - Renders the text passed in out. S