apidock.com Archives - 22 April 2013, Monday

  • attr_accessor_with_default (Module)

    apidock.com 18 Apr '13, 4pm

    Method deprecated or moved This method is deprecated or moved on the latest stable version. The last existing version (v3.1.0) is shown here. attr_accessor_with_default (sym, default = Proc.new) public Declare an attribute accessor with an initial default return value. To give attribu...

  • forty_two (Array)

    apidock.com 17 Apr '13, 5pm

    Equal to self[41] . Also known as accessing “the reddit”. Show source # File activesupport/lib/active_support/core_ext/array/access.rb, line 43 def forty_two self [ 41 ] end

  • ActiveRecord::Base

    apidock.com 17 Apr '13, 11am

    directly, but rather infer them from the table definition with which they’re linked. Adding, removing, and changing attributes and their type is done directly in the database. Any change is instantly reflected in the Active Record objects. The mapping that binds a given Active Record ...

  • (Hash)

    apidock.com 17 Apr '13, 7am

    populated with the given objects. Equivalent to the literal { key => value, … }. In the first form, keys and values occur in pairs, so there must be an even number of arguments. The second and third form take a single argument which is either an array of key-value pairs or an object c...

  • jj (Kernel)

    apidock.com 13 Apr '13, 9pm

    strings in a pretty format, with indentation and over many lines.

  • expires_in (ActionController::ConditionalGet)

    apidock.com 10 Apr '13, 8pm

    be aware that this writes to tmp/cache Its supposed to be http caching, but Rails will actually cache the response to whatever you specified as the cache store, *as well*, but only if you specify :public => true. The default is filestore so it will try to write to tmp/cache. Only a pr...

  • Set

    apidock.com 08 Apr '13, 12am

    ). Most of the initializer methods and binary operators accept generic Enumerable objects besides sets and arrays. An

  • increment! (ActiveRecord::Base)

    apidock.com 04 Apr '13, 2pm

    that saves the record. This method differs from its non-bang version in that it passes through the attribute setter. Saving is not subjected to validation checks. Returns

  • Net::HTTP

    apidock.com 04 Apr '13, 12pm

    If you wish to re-use a connection across multiple HTTP requests without automatically closing it you can use ::new instead of ::start . #request will automatically open a connection to the server if one is not currently open. You can manually close the connection with

  • values_at (Hash)

    apidock.com 02 Apr '13, 8pm

    Return an array containing the

  • squish (String)

    apidock.com 01 Apr '13, 7am

    removing all whitespace on both ends of the string, and then changing remaining consecutive whitespace groups into one space each.

  • first_or_create (ActiveRecord::Relation)

    apidock.com 31 Mar '13, 10pm

    Tries to load the first record; if it fails, then create is called with the same arguments as this method. Expects arguments in the same format as Base.create. Examples # Find the first user named Penélope or create a new one. User . where ( :first_name => ' Penélope '). first_or_cr...

  • prev_month (Date)

    apidock.com 31 Mar '13, 10pm

    Show source # File activesupport/lib/active_support/core_ext/date/calculations.rb, line 168 def prev_month months_ago ( 1 ) end

  • clear_helpers (AbstractController::Helpers::ClassMethods)

    apidock.com 30 Mar '13, 11am

    Clears up all existing helpers in this class, only keeping the helper with the same name as this class. Show source # File actionpack/lib/abstract_controller/helpers.rb, line 104 def clear_helpers inherited_helper_methods = _helper_methods self . _helpers = Module . new self . _helper...

  • DateTime

    apidock.com 29 Mar '13, 6am

    No documentation This class has no description. You can help the Ruby on Rails community by adding new notes. Show files where this class is defined (5 files) activesupport/lib/active_support/core_ext/date_time/conversions.rb activesupport/lib/active_support/core_ext/date_time/calcula...

  • between? (ActiveSupport::TimeWithZone)

    apidock.com 29 Mar '13, 6am

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

    Related:
    1. DateTime apidock.com 29 Mar '13, 6am
  • forty_two (Array)

    apidock.com 28 Mar '13, 9am

    Equal to self[41] . Also known as accessing “the reddit”. Show source # File activesupport/lib/active_support/core_ext/array/access.rb, line 43 def forty_two self [ 41 ] end

  • find_in_batches (ActiveRecord::Batches)

    apidock.com 27 Mar '13, 7pm

    You can control the starting point for the batch processing by supplying the :start option. This is especially useful if you want multiple workers dealing with the same processing queue. You can make worker 1 handle all the records between id 0 and 10,000 and worker 2 handle from 10,0...

  • serialize (ActiveRecord::Base)

    apidock.com 18 Mar '13, 3pm

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

  • index_by (Enumerable)

    apidock.com 18 Mar '13, 1am

    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-2013 Flowdock - Team Inbox With Chat for Software Developers Check out how the team behind APIdock conne...

  • delete (Hash)

    apidock.com 13 Mar '13, 1pm

    Note that the ActiveSupport library provides the except and except! methods, which return the Hash minus the given keys . So you don’t need to write your own wrapper if you happen to be using Rails or ActiveSupport as a stand-alone library: http://apidock.com/rails/ActiveSupport/CoreE...

  • attribute_method_suffix (ActiveRecord::AttributeMethods::ClassMethods)

    apidock.com 09 Mar '13, 7pm

    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 v3.2.8: ActiveModel::AttributeMethods::ClassMethods#attribute_method_suffix

  • date_select (ActionView::Helpers::DateHelper)

    apidock.com 01 Mar '13, 7pm

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

  • dump (CSV)

    apidock.com 10 Feb '13, 8am

    This method allows you to serialize an Array of Ruby objects to a String or File of CSV data. This is not as powerful as Marshal or YAML, but perhaps useful for spreadsheet and database interaction. Out of the box, this method is intended to work with simple data objects or Structs. I...

  • strip_heredoc (String)

    apidock.com 30 Dec '12, 5am

    Strips indentation in heredocs. For example in if options [ :usage ] puts <<- USAGE . strip_heredoc This command does such and such. Supported options are: -h This message ... USAGE end the user would see the usage message aligned against the left margin. Technically, it looks for the...

  • crypt (String)

    apidock.com 07 Dec '12, 1am

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

  • flat_map (Enumerable)

    apidock.com 23 Nov '12, 10pm

    Returns a new array with the concatenated results of running block once for every element in enum . If no block is given, an enumerator is returned instead. [[ 1 , 2 ],[ 3 , 4 ]]. flat_map {| i | i } #=> [1, 2, 3, 4]

  • each_with_object (Enumerable)

    apidock.com 05 Nov '12, 1am

    that you can’t use immutable objects like numbers, true or false as the memo. You would think the following returns 120, but since the memo is never changed, it does not.

  • ActiveModel::Callbacks

    apidock.com 04 Nov '12, 7pm

    This will provide all three standard callbacks (before, around and after) for both the :create and :update methods. To implement, you need to wrap the methods you want callbacks on in a block so that the callbacks get a chance to fire:

  • capture (ActionView::Helpers::CaptureHelper)

    apidock.com 16 Sep '12, 2am

    Coding test and analyzer @ DupCode We are soon launching DupCode.com, at which you can test and analyze your coding skills, compete with friends and at the same time pave the way to professional coder Come drop your email at DupCode.com and we will inform you the minute we launch!