apidock.com Archives - 25 April 2017, Tuesday

  • attachment (ActionMailer::PartContainer)

    apidock.com 06 Mar '17, 3am

    attachments and implicit multipart There is a small gotcha - this caught me up for a while. If you are using implicit multipart mime types by naming your template xxx.text.html.erb and xxx.text.plain.erb, you will need to change your template name back to the original xxx.erb. If you ...

  • is_a? (ActiveSupport::Duration)

    apidock.com 02 Mar '17, 2pm

    This method has no description. You can help the Ruby on Rails community by adding new notes.

  • source_location (Method)

    apidock.com 19 Feb '17, 4pm

    source filename and line number containing this method or nil if this method was not defined in

  • group_by (Enumerable)

    apidock.com 04 Feb '17, 1am

    * * call-seq: * enum.group_by {| obj | block } => a_hash * * Returns a hash, which keys are evaluated result from the * block, and values are arrays of elements in <i>enum<

  • assert_valid_keys (Hash)

    apidock.com 19 Dec '16, 7am

    Note that keys are treated differently than HashWithIndifferentAccess, meaning that string and symbol keys will not match.

  • ids (ActiveRecord::Calculations)

    apidock.com 15 Oct '16, 7pm

    Pluck all the ID’s for the relation using the table’s primary key Person . ids # SELECT people.id FROM people Person . joins ( :companies ). ids # SELECT people.id FROM people INNER JOIN companies ON companies.person_id = people.id Show source # File activerecord/lib/active_record/rel...

  • delete_if (Hash)

    apidock.com 26 Aug '16, 8pm

    Welcome Register Projects Help About Blog APIdock release: IRON STEVE (1.4) If you have any comments, ideas or feedback, feel free to contact us at APIdock copyright Nodeta Oy 2008-2016 Flowdock - Team Inbox With Chat for Software Developers Check out how the team behind APIdock conne...

  • to_json (Hash)

    apidock.com 15 Jul '16, 12am

    also filter down to any hash values. This is particularly useful for converting hashes containing ActiveRecord objects or any object that responds to options in their

  • create_join_table (ActiveRecord::ConnectionAdapters::SchemaStatements)

    apidock.com 24 Apr '16, 10pm

    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 t...

  • forty_two (Array)

    apidock.com 11 Sep '15, 3pm

    Welcome Register Projects Help About Blog APIdock release: IRON STEVE (1.4) If you have any comments, ideas or feedback, feel free to contact us at APIdock copyright Nodeta Oy 2008-2015 Flowdock - Team Inbox With Chat for Software Developers Check out how the team behind APIdock conne...

  • html_safe (String)

    apidock.com 16 Jun '15, 8pm

    Marks a string as trusted safe. It will be inserted into HTML with no additional escaping performed. It is your responsibilty to ensure that the string contains no malicious content. This method is equivalent to the `raw` helper in views. It is recommended that you use `sanitize` inst...

  • select (ActiveRecord::QueryMethods)

    apidock.com 09 Mar '15, 10pm

    First: takes a block so it can be used just like Array#select. Model . all . select { | m | m . field == value } This will build an array of objects from the database for the scope, converting them into an array and iterating through them using Array#select. Second: Modifies the SELEC...

  • presence (Object)

    apidock.com 09 Mar '15, 3pm

    Returns the receiver if it’s present otherwise returns nil . object.presence is equivalent to object . present? ? object : nil For example, something like state = params [ :state ] if params [ :state ]. present? country = params [ :country ] if params [ :country ]. present? region = s...

  • klass (ActiveRecord::Reflection::AssociationReflection)

    apidock.com 22 Jan '15, 1pm

    Returns the target association’s class. class Author < ActiveRecord :: Base has_many :books end Author . reflect_on_association ( :books ). klass # => Book Note: Do not call klass .new or klass .create to instantiate a new association object. Use build_association or create_associatio...

  • composed_of (ActiveRecord::Aggregations::ClassMethods)

    apidock.com 21 Jan '15, 9am

    :class_name - Specifies the class name of the association. Use it only if that name can’t be inferred from the part id. So composed_of :address will by default be linked to the Address class, but if the real class name is CompanyAddress, you’ll have to specify it with this option. :ma...

  • forty_two (ActiveSupport::CoreExtensions::Array::Access)

    apidock.com 08 Jan '15, 1pm

    This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here. These similar methods exist in v4.1.8: Array#forty_two ActiveRecord::Associations::CollectionAssociation#forty_two ActiveRecord::Associations::CollectionProxy#forty_two A...

  • fetch (Hash)

    apidock.com 08 Jan '15, 2am

    can’t be found, there are several options: With no other arguments, it will raise an KeyError exception; if default is given, then that will be returned; if the optional code block is specified, then that will be run and its result returned.

  • changed_for_autosave? (ActiveRecord::AutosaveAssociation)

    apidock.com 25 Dec '14, 2am

    Returns whether or not this record has been changed in any way (including whether any of its nested autosave associations are likewise changed) Show source # File activerecord/lib/active_record/autosave_association.rb, line 253 def changed_for_autosave? new_record? || changed? || mark...

  • serialize (ActiveRecord::Base)

    apidock.com 25 Oct '14, 10pm

    If you have an attribute that needs to be saved to the database as an object, and retrieved as the same object, then specify the name of that attribute using this method and it will be handled automatically. The serialization is done through YAML . If class_name is specified, the seri...

  • memoize (ActiveSupport::Memoizable)

    apidock.com 27 Sep '14, 6pm

    # include InstanceMethods # if method_defined?(:#{original_method}) # if method_defined?(:_unmemoized_mime_type) raise "Already memoized #{symbol}" # raise "Already memoized mime_type" end # end alias #{original_method} #{symbol} # alias _unmemoized_mime_type mime_type # if instance_m...

  • crypt (String)

    apidock.com 02 Aug '14, 4pm

    From the man page: If salt is a character string starting with the characters “$id$” followed by a string terminated by “$”: $id$salt$encrypted then instead of using the DES machine, id identifies the encryption method used and this then determines how the rest of the password string ...

  • has_many (ActiveRecord::Associations::ClassMethods)

    apidock.com 27 Jul '14, 7am

    Specifies an association through which to perform the query. This can be any other type of association, including other :through associations. Options for :class_name, :primary_key and :foreign_key are ignored, as the association uses the source reflection. If the association on the j...

  • const_set (Module)

    apidock.com 03 Jul '14, 9pm

    Sets the named constant to the given object, returning that object. Creates a new constant if no constant with the given

  • (ActiveResource::Base)

    apidock.com 27 Jun '14, 4pm

    for equality. Resource are equal if and only if other is the same object or is an instance of the same class, is not

  • url_for (ActionView::Helpers::UrlHelper)

    apidock.com 09 Jun '14, 7am

    Specify :host option in emails Emails need a fully qualified URL (with domain). Use the :host parameter. But note also that you need to specify a value that is not dependent upon the request context. http://api.rubyonrails.org/classes/ActionMailer/Base.html recommends setting a defaul...

  • in_groups_of (Array)

    apidock.com 30 May '14, 2pm

    Splits or iterates over the array in groups of size number, padding any remaining slots with

  • layout (AbstractController::Layouts::ClassMethods)

    apidock.com 26 May '14, 8am

    Specify the layout to use for this class. If the specified layout is a: String the String is the template name Symbol call the method specified by the symbol, which will return the template name false There is no layout true raise an ArgumentError nil Force default layout behavior wit...

  • define_method (Module)

    apidock.com 24 May '14, 10pm

    Defines an instance method in the receiver. The method parameter can be a Proc, a Method or an UnboundMethod object. If a block is specified, it is used as the method body. This block is evaluated using instance_eval, a point that is tricky to demonstrate because define_method is priv...

  • validates_with (ActiveModel::Validations::ClassMethods)

    apidock.com 20 May '14, 4am

    :on - Specifies when this validation is active (:create or :update . :if - Specifies a method, proc or string to call to determine if the validation should occur (e.g. if: :allow_validation, or if: Proc.new { |user| user.signup_step > 2 } ). The method, proc or string should return or...

  • syswrite (IO)

    apidock.com 16 May '14, 7am

    written. Do not mix with other methods that write to ios or you may get unpredictable results. Raises