lib/trust/controller/resource.rb
def collection(associated_resource, instance = nil)
        if associated_resource && associated_resource.object
          [associated_resource.object, instance || association_name(associated_resource).to_sym]
        else
          klass
        end
      end
# Returns a collection that can be used for index, new and creation actions.
#
# If specifying an instance, returns the full path for that instance. Can be used when not using shallow routes
#
# === Example
#
#   Assumption
#     resource is instance of Lottery::Package #1 (@lottery_package)
#     association is Lottery::Prizes
#     if association is named lottery_prizes, then [@lottery_package, :lottery_prizes] is returned
#     if association is named prizes, then [@lottery_package, :prizes] is returned
#     if you specify an instance, then [@lottery_package, @prize] is returned
#
Returns a collection that can be used for index, new and creation actions.
If specifying an instance, returns the full path for that instance. Can be used when not using shallow routes

Example


Returns a collection that can be used for index new and creation actions . If specifying an instance returns the full path for that instance . Can be used when not using shallow routes Example
def collection(associated_resource, instance = nil)
        if associated_resource && associated_resource.object
          [associated_resource.object, instance || association_name(associated_resource).to_sym]
        else
          klass
        end
      end
def collection ( associated_resource , instance = nil ) if associated_resource && associated_resource . object [ associated_resource . object , instance || association_name ( associated_resource ) . to_sym ] else klass end end
Returns a collection that can be used for index, new and creation actions.
Returns a collection that can be used for index new and creation actions .
associated_resource
instance