apidock.com Archives - 11 April 2013, Thursday

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

    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!

  • becomes (ActiveRecord::Persistence)

    apidock.com 14 Aug '12, 9am

    Returns an instance of the specified klass with the attributes of the current record. This is mostly useful in relation to single-table inheritance structures where you want a subclass to appear as the superclass. This can be used along with record identification in Action Pack to all...

  • Ruby

    apidock.com 13 Aug '12, 11pm

    This command will create following directories and install files onto them. * ${DESTDIR}${prefix}/bin * ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY} * ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM} * ${DESTDIR}${prefix}/lib * ${DESTDIR}${prefix}...

  • delegate (Module)

    apidock.com 11 Aug '12, 9am

    class method to easily expose contained objects’ methods as your own. Pass one or more methods (specified as symbols or strings) and the name of the target object via the :to option (also a symbol or string). At least one method and the

  • define (ActiveRecord::Schema)

    apidock.com 10 Aug '12, 1am

    Eval the given block. All methods available to the current connection adapter are available within the block, so you can easily use the database definition DSL to build up your schema (create_table, add_index, etc.). The info hash is optional, and if given is used to define metadata a...

  • gsub (String)

    apidock.com 09 Aug '12, 11pm

    it will be substituted for the matched text. It may contain back-references to the pattern’s capture groups of the form \d, where d is a group number, or \k<n>, where n is a group name. If it is a double-quoted string, both back-references must be preceded by an additional backslash. ...