<=>

ary other_ary â -1, 0, +1 or nil Instance Public methods Comparison â Returns an integer (-1, 0, or +1) if this array is less than, equal to, or greater than other_ary. nil is returned if the two values are incomparable. Each object in each array is compared (using the <=> operator). Arrays are compared in an âelement-wiseâ manner; the first two elements that are not equal will determine the return value for the whole comparison. If all the values are equal, then the ret

to_der

to_der() Instance Public methods

new

new(app, check_ip_spoofing = true, custom_proxies = nil) Class Public methods Create a new RemoteIp middleware instance. The check_ip_spoofing option is on by default. When on, an exception is raised if it looks like the client is trying to lie about its own IP address. It makes sense to turn off this check on sites aimed at non-IP clients (like WAP devices), or behind proxies that set headers in an incorrect or confusing way (like AWS ELB). The custom_proxies argument can take a r

sort

enum.sort â arrayenum.sort { |a, b| block } â array Instance Public methods Returns an array containing the items in enum sorted, either according to their own <=> method, or by using the results of the supplied block. The block should return -1, 0, or +1 depending on the comparison between a and b. As of Ruby 1.8, the method Enumerable#sort_by implements a built-in Schwartzian Transform, useful when key computation or comparison is expensive. %w(rhea kea fl

toggle

toggle() Class Public methods

invoke_task

invoke_task(task_string) Instance Public methods private âââââââââââââââââââââ-

humanize

humanize(options = {}) Instance Public methods Capitalizes the first word, turns underscores into spaces, and strips a trailing '_id' if present. Like titleize, this is meant for creating pretty output. The capitalization of the first word can be turned off by setting the optional parameter capitalize to false. By default, this parameter is true. 'employee_salary'.humanize # => "Employee salary" 'author_id'.humanize # => "Author" 'author_id'.hu

time_field

time_field(object_name, method, options = {}) Instance Public methods Returns a #text_field of type âtimeâ. The default value is generated by trying to call strftime with â%T.%Lâ on the objects's value. It is still possible to override that by passing the âvalueâ option. Options Accepts same options as time_field_tag Example time_field("task", "started_at") # => <input id="task_started_at" name="task[started_at]" type="time" />

create_join_table

create_join_table(table_1, table_2, options = {}) Instance Public methods Creates a new join table with the name created using the lexical order of the first two arguments. These arguments can be a String or a Symbol. # Creates a table called 'assemblies_parts' with no id. create_join_table(:assemblies, :parts) You can pass a options hash can include the following keys: :table_name Sets the table name overriding the default :column_options Any extra options you want appende

stale?

stale?(record_or_options, additional_options = {}) Instance Public methods Sets the etag and/or last_modified on the response and checks it against the client request. If the request doesn't match the options provided, the request is considered stale and should be generated from scratch. Otherwise, it's fresh and we don't need to generate anything and a reply of 304 Not Modified is sent. Parameters: :etag. :last_modified. :public By default the Cache-Control header is private,