Specifies a many-to-many relationship with another class. This associates two classes via an intermediate join table. Unless the join table is explicitly specified as an option, it is guessed using the lexical order of the class names. So a join between Developer and Project will give...
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 repl...
activesupport/lib/active_support/core_ext/array/access.rb activesupport/lib/active_support/core_ext/array/conversions.rb activesupport/lib/active_support/core_ext/array/extract_options.rb activesupport/lib/active_support/core_ext/array/grouping.rb activesupport/lib/active_support/core...
Active Record implements aggregation through a macro-like class method called composed_of for representing attributes as value objects. It expresses relationships like “Account [is] composed of Money [among other things]” or “Person [is] composed of [an] address”. Each call to the mac...
mb_chars is a multibyte safe proxy for string methods. In Ruby 1.8 and older it creates and returns an instance of the ActiveSupport::Multibyte::Chars class which encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy class. If the...
Returns a checkbox tag tailored for accessing a specified attribute (identified by method ) on an object assigned to the template (identified by object ). This object must be an instance object (@object) and not a local object. It’s intended that method returns an integer and if that ...
The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without, and class names to foreign keys. The default inflections for pluralization, singularization, and uncountable words are kept in inflections.rb. The Rails core te...
Returns a YAML representation of object wrapped with <pre> and </pre>. If the object cannot be converted to YAML using to_yaml , inspect will be called instead. Useful for inspecting an object at the time of rendering. Example @user = User.new({ :username => 'testing', :password => 'x...
Class HTML::Sanitizer < Object actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
mb_chars is a multibyte safe proxy for string methods. In Ruby 1.8 and older it creates and returns an instance of the ActiveSupport::Multibyte::Chars class which encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy class. If the...
# File activesupport/lib/active_support/json/encoding.rb, line 239 def encode_json (encoder ) # values are encoded with use_options = false, because we don't want hash representations from ActiveModel to be # processed once again with as_json with options, as this could cause unexpect...
Yields each batch of records that was found by the find options as an array. The size of each batch is set by the :batch_size option; the default is 1000. You can control the starting point for the batch processing by supplying the :start option. This is especially useful if you want ...
:use_month_numbers - Set to true if you want to use month numbers rather than month names (e.g. "2" instead of "February"). :use_short_month - Set to true if you want to use abbreviated month names instead of full month names (e.g. "Feb" instead of "February"). :add_month_numbers - Se...
Action View templates can be written in several ways. If the template file has a .erb extension then it uses a mixture of ERb (included in Ruby) and HTML . If the template file has a .builder extension then Jim Weirich’s Builder::XmlMarkup library is used.
List of HTTP request methods from the following RFCs: Hypertext Transfer Protocol – HTTP/1.1 (www.ietf.org/rfc/rfc2616.txt ) HTTP Extensions for Distributed Authoring – WEBDAV (www.ietf.org/rfc/rfc2518.txt ) Versioning Extensions to WebDAV (www.ietf.org/rfc/rfc3253.txt ) Ordered Colle...
Returns a new Time where one or more of the elements have been changed according to the options parameter. The time options (hour, minute, sec, usec) reset cascadingly, so if only the hour is passed, then minute, sec, and usec is set to 0. If the hour and minute is passed, then sec an...
Starts a debugging session if ruby-debug has been loaded (call rails server –debugger to do load it). Also aliased as: breakpoint Source: show | on GitHub # File activesupport/lib/active_support/core_ext/kernel/debugger.rb, line 4 def debugger message = "\n***** Debugger requested, bu...
Specifies a many-to-many relationship with another class. This associates two classes via an intermediate join table. Unless the join table is explicitly specified as an option, it is guessed using the lexical order of the class names. So a join between Developer and Project will give...
MessageEncryptor is a simple way to encrypt values which get stored somewhere you don't trust. The cipher text and initialization vector are base64 encoded and returned to you. This can be used in situations similar to the MessageVerifier , but where you don’t want users to be able to...
MessageVerifier makes it easy to generate and verify messages which are signed to prevent tampering. This is useful for cases like remember-me tokens and auto-unsubscribe links where the session store isn’t suitable or available. Remember Me: cookies[:remember_me] = @verifier.generate...
Performs a GET request with the given parameters. path : The URI (as a String ) on which you want to perform a GET request. parameters : The HTTP parameters that you want to pass. This may be nil , a Hash , or a String that is appropriately encoded (application/x-www-form-urlencoded o...
Wrapping a string in this class gives you a prettier way to test for equality. The value returned by Rails.env is wrapped in a StringInquirer object so instead of calling this: Rails.env == "production" you can call this: Rails.env.production? Methods M method_missing Instance Public ...
These named scopes are composable. For instance, Shirt.red.dry_clean_only will produce all shirts that are both red and dry clean only. Nested finds and calculations also work with these compositions: Shirt.red.dry_clean_only.count returns the number of garments for which these criter...
:use_month_numbers - Set to true if you want to use month numbers rather than month names (e.g. "2" instead of "February"). :use_short_month - Set to true if you want to use abbreviated month names instead of full month names (e.g. "Feb" instead of "February"). :add_month_numbers - Se...
The TextHelper module provides a set of methods for filtering, formatting and transforming strings, which can reduce the amount of inline Ruby code in your views. These helper methods extend Action View making them callable within your template files. Sanitization Most text helpers by...
Provides methods for converting numbers into formatted strings. Methods are provided for phone numbers, currency, percentage, precision, positional notation, file size and pretty printing. Most methods expect a number argument, and will return it unchanged if can’t be converted into a...
are protective blocks where SQL statements are only permanent if they can all succeed as one atomic action. The classic example is a transfer between two accounts where you can only have a deposit if the withdrawal succeeded and vice versa. Transactions enforce the integrity of the da...
In MRI the Hash class is core and written in C. In particular, methods are programmed with explicit C function calls and polymorphism is not honored. For example, []= is crucial in this implementation to maintain the @keys array but hash.c invokes rb_hash_aset() originally. This preve...
where one or more of the elements have been changed according to the options parameter. The time options (hour, min, sec, usec) reset cascadingly, so if only the hour is passed, then minute, sec, and usec is set to 0. If the hour and minute is passed, then sec and usec is set to 0.
mb_chars is a multibyte safe proxy for string methods. In Ruby 1.8 and older it creates and returns an instance of the ActiveSupport::Multibyte::Chars class which encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy class. If the...