apidock.com Archives - 26 March 2013, Tuesday

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

  • strftime (ActiveSupport::TimeWithZone)

    apidock.com 08 Aug '12, 1am

    %a - The abbreviated weekday name (“Sun”) %A - The full weekday name (“Sunday”) %b - The abbreviated month name (“Jan”) %B - The full month name (“January”) %c - The preferred local date and time representation %d - Day of the month (01..31) %H - Hour of the day, 24-hour clock (00..23...

  • remove_const (Module)

    apidock.com 07 Aug '12, 9am

    Removes the definition of the given constant, returning that constant’s value. Although predefined classes/modules also can be removed, they just can’t be refered with the names but still exist. It could cause very severe confusion. Feel Free to Shoot Your Own Foot.

  • change_column_default (ActiveRecord::ConnectionAdapters::SchemaStatements)

    apidock.com 25 Jul '12, 8pm

    Register or log in to add new notes. mutru - October 10, 2008 7 thanks Implemented in database adapters These methods are not implemented in the abstract classes. Instead, all database adapters implement these separately, if the feature is supported. Vidmantas - July 30, 2009 2 thanks...

  • returning (Object)

    apidock.com 23 Jul '12, 8am

    to the block. This simplifies the process of constructing an object, performing work on the object, and then returning the object from a method. It is a Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.

    Related:
    1. returning (Object) apidock.com 23 Jul '12, 7am
  • returning (Object)

    apidock.com 23 Jul '12, 7am

    to the block. This simplifies the process of constructing an object, performing work on the object, and then returning the object from a method. It is a Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.

    Related:
    1. returning (Object) apidock.com 23 Jul '12, 8am
  • update_attributes (ActiveRecord::Base)

    apidock.com 20 Jul '12, 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.1: ActiveResource::Base#update_attributes Rails::Generators::ActiveModel#update_attributes ActiveRecord::Persistence#update_attributes

  • check_box_tag (ActionView::Helpers::FormTagHelper)

    apidock.com 20 Jul '12, 7pm

    In a /index type listing page we can no longer assume that the list of ids coming back represents changes to all objects so we need to provide some context, that the list of object modifications in our params array is a list of modifications for some set of objects.

  • group (ActiveRecord::QueryMethods)

    apidock.com 13 Jul '12, 9am

    No documentation This method has no description. You can help the Ruby on Rails community by adding new notes. Hide source # File activerecord/lib/active_record/relation/query_methods.rb, line 80 def group (* args ) return self if args . blank? relation = clone relation . group_values...

  • rescue_from (ActiveSupport::Rescuable::ClassMethods)

    apidock.com 12 Jul '12, 8am

    receives a series of exception classes or class names, and a trailing :with option with the name of a method or a Proc object to be called to handle them. Alternatively a block can be given.

  • Ruby on Rails

    apidock.com 11 Jul '12, 11am

    The Model layer represents your domain model (such as Account, Product, Person, Post ) and encapsulates the business logic that is specific to your application. In Rails, database-backed model classes are derived from ActiveRecord::Base . Active Record allows you to present the data f...

  • content_for (ActionView::Helpers::CaptureHelper)

    apidock.com 10 Jul '12, 3pm

    Clearing out previous values from content_for By default, content_for :thing appends whatever you put in your block to the previous value of :thing. In some cases, you’d like to clear out :thing rather than append to it. I just posted a way to do this on my blog: http://stevechanin.bl...

  • ActiveSupport::Memoizable

    apidock.com 09 Jul '12, 7pm

    this has been deprecated; see linked note This has been deprecated. See this note on memoize : http://apidock.com/rails/ActiveSupport/Memoizable/memoize#1317-this-has-been-deprecated-replace-with-Memoist

  • memoize (ActiveSupport::Memoizable)

    apidock.com 09 Jul '12, 7pm

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

    Related:
    1. ActiveSupport::Memoizable apidock.com 09 Jul '12, 7pm