apidock.com Archives - 04 May 2013, Saturday

  • fresh_when (ActionController::ConditionalGet)

    apidock.com 03 May '13, 9pm

    This will render the show template if the request isn’t sending a matching etag or If-Modified-Since header and just a

  • merge (ActiveRecord::SpawnMethods)

    apidock.com 30 Apr '13, 4am

    Makes it possible to use a scope through an association This is a very useful method if you want to to use a scope through an association: class Book < ActiveRecord :: Base scope :available , where ( :available => true ) end class Author < ActiveRecord :: Base has_many :books scope :w...

  • validates (ActiveModel::Validations::ClassMethods)

    apidock.com 27 Apr '13, 11am

    This method is a shortcut to all default validators and any custom validator classes ending in ‘Validator’. Note that Rails default validators can be overridden inside specific classes by creating custom validator classes in their place such as

  • try (Object)

    apidock.com 26 Apr '13, 6am

    rest of code is in NilClass#try If you click “Show source” here, you may get confused. The logic for #try is shared between this method and NilClass#try . Both versions are currently implemented in the file activesupport/lib/active_support/core_ext/object/try.rb .

  • display (Object)

    apidock.com 24 Apr '13, 2pm

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

  • update_attributes (ActiveRecord::Persistence)

    apidock.com 24 Apr '13, 5am

    Updates the attributes of the model from the passed-in hash and saves the record, all wrapped in a transaction. If the object is invalid, the saving will fail and false will be returned. When updating model attributes, mass-assignment security protection is respected. If no :as option...

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