Sha256: 915a35234de5634868d5abb4356587080f083590639d4b8beec20aa77f93bee5

Contents?: true

Size: 489 Bytes

Versions: 27

Compression:

Stored size: 489 Bytes

Contents

module Arrest
  class HasManyCollection < OrderedCollection 

    def initialize(parent, context, class_or_class_name, base_url, query_params = {})
      super(context, class_or_class_name, base_url, query_params)
      @parent = parent
      @foreign_key_name = (StringUtils.underscore(@parent.class.name).gsub(/^.*\//, '') + '_id').to_sym
    end

    def build(attributes = {})
      resolved_class.new(@context, {@foreign_key_name => @parent.id}.merge!(attributes))
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
arrest-0.0.91 lib/arrest/helper/has_many_collection.rb
arrest-0.0.90 lib/arrest/helper/has_many_collection.rb
arrest-0.0.89 lib/arrest/helper/has_many_collection.rb
arrest-0.0.88 lib/arrest/helper/has_many_collection.rb
arrest-0.0.87 lib/arrest/helper/has_many_collection.rb
arrest-0.0.86 lib/arrest/helper/has_many_collection.rb
arrest-0.0.85 lib/arrest/helper/has_many_collection.rb
arrest-0.0.84 lib/arrest/helper/has_many_collection.rb
arrest-0.0.83.crud lib/arrest/helper/has_many_collection.rb
arrest-0.0.83.1 lib/arrest/helper/has_many_collection.rb
arrest-0.0.83 lib/arrest/helper/has_many_collection.rb
arrest-0.0.82 lib/arrest/helper/has_many_collection.rb
arrest-0.0.80 lib/arrest/helper/has_many_collection.rb
arrest-0.0.79 lib/arrest/helper/has_many_collection.rb
arrest-0.0.78 lib/arrest/helper/has_many_collection.rb
arrest-0.0.77 lib/arrest/helper/has_many_collection.rb
arrest-0.0.76 lib/arrest/helper/has_many_collection.rb
arrest-0.0.75 lib/arrest/helper/has_many_collection.rb
arrest-0.0.74 lib/arrest/helper/has_many_collection.rb
arrest-0.0.73 lib/arrest/helper/has_many_collection.rb