Flowdock
method

only

Importance_0
v3.0.0 - Show latest stable - 0 notes - Class: ActiveRecord::SpawnMethods
only(*onlies) public

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/spawn_methods.rb, line 66
    def only(*onlies)
      result = self.class.new(@klass, table)

      onlies.each do |only|
        if (Relation::ASSOCIATION_METHODS + Relation::MULTI_VALUE_METHODS).include?(only)
          result.send("#{only}_values=""#{only}_values=", send("#{only}_values""#{only}_values"))
        elsif Relation::SINGLE_VALUE_METHODS.include?(only)
          result.send("#{only}_value=""#{only}_value=", send("#{only}_value""#{only}_value"))
        else
          raise "Invalid argument : #{only}"
        end
      end

      result
    end
Register or log in to add new notes.